This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programming Diversions and the fly likes puzzle - find ages of her son Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "puzzle - find ages of her son" Watch "puzzle - find ages of her son" New topic
Author

puzzle - find ages of her son

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830

One man went at woman�s house, for enquiry about her children.
She said she has 3 sons.
Multiplication of there ages is 36.
And sum is equal to house number in front of her house.

Then after listening this much that man left and come back again..
He said, I seen that house number. But your clues are not enough. Can you give me one more clue??
She said ..my big son is sleeping and I have to go!!!

Man said ..ok� I got answer!!!


Can you tell me ages of her son???
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11150
    
  16

I say it can't be done.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1006
    
    3
Originally posted by Fred Rosenberger:
I say it can't be done.


I would tend to disagree, Fred.

There are only so many ages for her sons with 36 as a product:
1 1 36 (sum = 38)
1 2 18 (sum = 21)
1 3 12 (sum = 16)
1 4 9 (sum = 14)
1 6 6 (sum = 13)
2 2 9 (sum = 13)
2 3 6 (sum = 11)
3 3 4 (sum = 10)

The only address (sum of ages) that would not provide enough information would be 13. So the sons are either 1 6 6 or 2 2 9. The statement that the lady's "big son is sleeping" implies that she has one single eldest son, as opposed to twins that are tied for being eldest. Therefore her sons are 2, 2, and 9.
Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1874
6/6/1 an 9/2/2.Big(eldest) son hence 9/2/2


MH
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11150
    
  16

Ask my nephew Teddy who is older - him, or his twin brother. He will gladly tell you he is - by 5 minutes.

he IS older than his brother, although they have the same age rounded off to years.

so, in your example, even in the case of the 1, 6 and 6 year old, ONE of those twins is older.
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

I guess the logic explained by Ryan McGuire seems to be quite perfect and agreeable here


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1006
    
    3
Fred, apparently you don't speak fluent Puzzlese. Maybe this summer you can take a vacation in Puzzlestan.

In that country, twins are EXACTLY the same age.

Also, jars come in weird, but very exact, sizes. When you pour liquids from one container to another, absolutely none is left in the first one.

It seems there is a dearth of scales that provide an actual number of grams. Instead everyone has double-pan balances, but they always seem to break after only three or four weighings.

Be careful, though, because the surrounding seas are crowded with pirates that are endlessly trying to divide various amounts of treasure "fairly".

The medieval castles there are particularly lovely and well-preserved, but if you want to visit them you have to make your own bridge across the moat using some number of planks that aren't quite long enough to reach the whole way across. Once you do make a bridge across the moat, the rest of your travel companions will be forced to walk at various speeds and the bridge will only hold two of you at a time.

Has anyone else taken a trip there (business or pleasure)? Am I leaving anything out?
[ January 31, 2008: Message edited by: Ryan McGuire ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
[Ryan]: In that country, twins are EXACTLY the same age.

And more generally, everyone's age is an exact integer.

[Ryan]: Am I leaving anything out?

Many of the inhabitants are incapable of ambiguity, and speak only perfect truths or perfect lies. Most speak only one or the other, though a few alternate with each statement.
[ January 31, 2008: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1006
    
    3
Originally posted by Jim Yingst:
Many of the inhabitants are incapable of ambiguity, and speak only perfect truths or perfect lies. Most speak only one or the other, though a few alternate with each statement.


And the judges there often determine which prisoners should live or die based on them guessing the color of their hats.
 
 
subject: puzzle - find ages of her son
 
Similar Threads
A Puzzle of Oranges
Euthanasia
Forwards ...
Only fun forwards for fun ...
Ann Coulter's new book