wu :: forums
« wu :: forums - Wealthy Man, Three Sons And  Number Puzzle »

Welcome, Guest. Please Login or Register.
Nov 12th, 2024, 11:49am

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   cs
(Moderators: ThudnBlunder, towr, Eigenray, SMQ, Icarus, william wu, Grimbal)
   Wealthy Man, Three Sons And  Number Puzzle
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Wealthy Man, Three Sons And  Number Puzzle  (Read 1539 times)
K Sengupta
Senior Riddler
****





   


Gender: male
Posts: 371
Wealthy Man, Three Sons And  Number Puzzle  
« on: Apr 2nd, 2009, 9:36pm »
Quote Quote Modify Modify

A wealthy man had three sons. To get a share of his inheritance each had to correctly determine a positive integer of his choice. The number had four nonzero decimal digits in strictly ascending order.  
 
He prepared three sealed envelopes, each of which contained a number. The first contained the product of the four digits, the second contained the sum of the squares of the four digits, and the third contained the result of summing the product of the first two digits and the product of the last two digits. The three envelopes were clearly marked as such.  
 
He showed the envelopes to his three sons and had them each take one at random. The sons were at three different computers, so they couldn’t communicate with one another, but each were linked to their father’s computer. After an hour they could submit a number or decline. Anyone who submitted a wrong answer would be eliminated and get nothing. If one or more submitted the correct answer, they would each receive a share of the inheritance, and the contest would end with the others getting nothing. If no one submitted the correct answer, they would be instructed to work on the problem for another hour. The process would repeat as often as necessary.
 
At the end of the first hour, no one had submitted an answer. At the end of the second hour, no one had submitted an answer. At the end of the third hour, no one had submitted an answer. At the end of the fourth hour, all three of them had submitted the correct answer.
 
Can you determine the number?
IP Logged
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: Wealthy Man, Three Sons And  Number Puzzle  
« Reply #1 on: Apr 3rd, 2009, 3:59am »
Quote Quote Modify Modify

hidden:
Create a graph.
This graph will have three types of edges, one for each brother.
For each valid pair of 4 digits, create a node.  
Link nodes with an edge if that brother has the same number in his envelope in both nodes.
Remove all nodes which for any type of edge has only one outgoing edge. (These brothers would have thought they knew the digits. Note that this would have to be a reflexive edge, each node is necessarily linked to itself.)
Remove all nodes which for any type of edge has only one outgoing edge. (Again)
Remove all nodes which for any type of edge has only one outgoing edge. (And again)
There should now be one node that has one outgoing edge of each type, seeing as all three brothers know the digits.
« Last Edit: Apr 3rd, 2009, 4:02am by towr » IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: Wealthy Man, Three Sons And  Number Puzzle  
« Reply #2 on: Apr 3rd, 2009, 6:13am »
Quote Quote Modify Modify

hidden:
digit(X) :- member(X, [1,2,3,4,5,6,7,8,9]).
quad([A,B,C,D]) :- digit(A), digit(B), A<B, digit(C), B < C, digit(D), C < D.
 
makelinks([A1,A2,A3,A4],[B1,B2,B3,B4]) :-  
   (A1*A2*A3*A4    =:= B1*B2*B3*B4    -> assert(link(a, [A1,A2,A3,A4],[B1,B2,B3,B4])) ; true),
   (A1^2+A2^2+A3^2+A4^2 =:= B1^2+B2^2+B3^2+B4^2 -> assert(link(b, [A1,A2,A3,A4],[B1,B2,B3,B4])) ; true),
   (A1*A2+A3*A4    =:= B1*B2+B3*B4    -> assert(link(c, [A1,A2,A3,A4],[B1,B2,B3,B4])) ; true).
 
init :- retractall(link(_, _, _)),
   forall((quad(N1), quad(N2)), makelinks(N1,N2)).
 
outdegree(Q, B, N) :- findall( Q2, link(B, Q, Q2), Qs), length(Qs, N).
 
prune :-
  findall(Quad, (quad(Quad), (outdegree(Quad, a, 1);outdegree(Quad, b, 1);outdegree(Quad, c, 1)) ), Qs),
  forall(member(Q, Qs), (retractall(link(a, Q, _)), retractall(link(a, _, Q)),  
     retractall(link(b, Q, _)), retractall(link(b, _, Q)),  
     retractall(link(c, Q, _)), retractall(link(c, _, Q)))).
 
print_remaining :-
  findall(Quad, (quad(Quad), (outdegree(Quad, a, 1),outdegree(Quad, b, 1),outdegree(Quad, c, 1)) ), Qs),  
  write(Qs).
 
start :- init, prune, prune, prune, print_remaining.
 
% answer --> 3479
IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
Hippo
Uberpuzzler
*****





   


Gender: male
Posts: 919
Re: Wealthy Man, Three Sons And  Number Puzzle  
« Reply #3 on: Apr 3rd, 2009, 7:53am »
Quote Quote Modify Modify

towr: Several such examples and I'll start using Prolog. (and/or Mathematica ...)
IP Logged
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: Wealthy Man, Three Sons And  Number Puzzle  
« Reply #4 on: Apr 3rd, 2009, 7:57am »
Quote Quote Modify Modify

This isn't really a very good example of prolog, though; using asserts is generally considered a bit iffy (since it depends on side-affects).
But thanks for the compliment Smiley
IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
SMQ
wu::riddles Moderator
Uberpuzzler
*****






   


Gender: male
Posts: 2084
Re: Wealthy Man, Three Sons And  Number Puzzle  
« Reply #5 on: Apr 3rd, 2009, 8:46am »
Quote Quote Modify Modify

Bonus questions: assuming the father intended the contest to be fair--i.e. if no mistakes were made all three would share the inheritance--what numbers could he have chosen?  How many of those are non-trivial, i.e. not answered in the first hour?
 
--SMQ
IP Logged

--SMQ

towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: Wealthy Man, Three Sons And  Number Puzzle  
« Reply #6 on: Apr 3rd, 2009, 11:59am »
Quote Quote Modify Modify

on Apr 3rd, 2009, 8:46am, SMQ wrote:
Bonus questions: assuming the father intended the contest to be fair--i.e. if no mistakes were made all three would share the inheritance--what numbers could he have chosen?  How many of those are non-trivial, i.e. not answered in the first hour?

 
After one hour, there's 1234, 1235, 1236, 1245, 1257, 3679, 3689, 4589, 4689, 4789, 5689, 5789 and 6789
After two hours, there's 1267 and 2489
And after 4 hours, as we've seen, 3479
And that's it. After 4 prunings, there are no nodes left at all (I had thought there might be some equivalence classes left, but this turns out not to be the case.)
« Last Edit: Apr 3rd, 2009, 12:12pm by towr » IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
kg
Newbie
*





   


Posts: 18
Re: Wealthy Man, Three Sons And  Number Puzzle  
« Reply #7 on: Apr 6th, 2009, 8:17pm »
Quote Quote Modify Modify

on Apr 3rd, 2009, 3:59am, towr wrote:
hidden:
Create a graph.
This graph will have three types of edges, one for each brother.
For each valid pair of 4 digits, create a node.  
Link nodes with an edge if that brother has the same number in his envelope in both nodes.
Remove all nodes which for any type of edge has only one outgoing edge. (These brothers would have thought they knew the digits. Note that this would have to be a reflexive edge, each node is necessarily linked to itself.)
Remove all nodes which for any type of edge has only one outgoing edge. (Again)
Remove all nodes which for any type of edge has only one outgoing edge. (And again)
There should now be one node that has one outgoing edge of each type, seeing as all three brothers know the digits.

Is 1678 the right answer
IP Logged
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: Wealthy Man, Three Sons And  Number Puzzle  
« Reply #8 on: Apr 7th, 2009, 12:07am »
Quote Quote Modify Modify

on Apr 6th, 2009, 8:17pm, kg wrote:

Is 1678 the right answer
It's not the answer I get, I get 3479
IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
SMQ
wu::riddles Moderator
Uberpuzzler
*****






   


Gender: male
Posts: 2084
Re: Wealthy Man, Three Sons And  Number Puzzle  
« Reply #9 on: Apr 7th, 2009, 4:59am »
Quote Quote Modify Modify

on Apr 6th, 2009, 8:17pm, kg wrote:
Is 1678 the right answer

I find that only one brother would have known the number was 1678. not all three.
 
--SMQ
IP Logged

--SMQ

Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board