This week's book giveaway is in the Open Source forum. We're giving away four copies of RabbitMQ in Depth and have Gavin Roy on-line! See this thread for details.

The Bartender's Kids =========================== A man walks into a bar, orders a drink, and starts chatting with the bartender. After a while, he learns that the bartender has three children. "How old are your children?" he asks. "Well," replies the bartender, "the product of their ages is 72." The man thinks for a moment and then says, "That's not enough information." "All right," continues the bartender, "if you go outside and look at the building number posted over the door to the bar, you'll see the sum of the ages." The man steps outside, and after a few moments he reenters and declares, "Still not enough!" The bartender smiles and says, "My youngest just loves strawberry ice cream." How old are the children? [ February 13, 2004: Message edited by: HS Thomas ]

i hate these questions. ;-) i think all the posibilities that give 72 as a product are 72,1,1 sum = 74 36,2,1 sum = 39 24,3,1 sum = 28 18,4,1 sum = 23 18,2,2 sum = 22 12,6,1 sum = 19 12,3,2 sum = 17 9,8,1 sum = 18 9,4,2 sum = 15 8,3,3 sum = 14 6,6,2 sum = 14 6,3,4 sum = 13 but now i'm stuck. if the visitor can't tell their ages, then it can't be any of the elemets that give a unique sum. so they're either 8,3 and 3, or 6,6, and 2. i don't see how to figure out which one is the correct one. [ February 13, 2004: Message edited by: fred rosenberger ]

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

the man is smart enough to generate the same list of possible ages that Fred did

if two children have the same age, neither may be called older or younger

Given the sum, the man was unable to determine the ages. That means it was a sum shared by more than one combination of ages. Which means it's one of these two: 8,3,3 sum = 14 6,6,2 sum = 14 Of these two, the first has no youngest child. Therefore the ages are 6, 6, 2.

"I'm not back." - Bill Harding, Twister

HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404

posted

0

Thanks you two for solving it with such clarity. I did get 6,6,2 but more because it felt right.

i guess my problem was that i have twin nephews. while they are indeed both 7 years old, one IS actually 5 minutes younger than the other. so one IS the youngest. but if we agree with Jim's 3rd assumption (which clearly i'm not sure is valid, but i'll let it go ), then yes, we can solve the problem.

Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671

posted

0

All three assumptions are extremely dubious in the real world; that's why I thought it necessary to explicitly state them. Even without twins, it's quite possible for two children less than 12 months apart to have the same "age" when age is truncated (or possibly rounded) to an integer. In the real world, the info "My youngest just loves strawberry ice cream" is completely useless, and the problem has no single solution. I tried to find a minimal set of assumptions that would allow a unique solution.

btw, i sometimes feel humbled talking about stuff with folks who have 30 - 100 times the number of posts i have...

Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671

posted

0

That may just indicate that you actually have some sort of life in the outside world.

HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404

posted

0

The only way to get a free drink in this bar is to prove to the barman that you are a friend of his boss. Here's how it's done. You go to the barman, he tells you a number and you tell him the "countersign" number. If your answer is correct you get your drink. There's this mathematician who thought that there can't be a standard list of numbers and countersign numbers. There must be an algorithm that provides the answer from the number given by the barman. So he joins a party of three men who ARE friends of the boss and walks with them to the bar hoping to understand the algorithm from the three answers. HERE'S WHAT HE HEARD: The barman says "6" to the first man, he says "3" and got his drink. The barman said "12" to the second man, who replied "6" and got his drink. The barman said "14" to the third man and he answered "8" and got his drink. Now it's the mathematicians turn. "20", said the barman. What is the counter sign?

The mathematician should say 6. The algorithm is to count the number of alphabets in the barman's number. Is that right? [ February 16, 2004: Message edited by: Anu Ram ]

Originally posted by Anu Ram: The mathematician should say 6. The algorithm is to count the number of alphabets in the barman's number. Is that right? [ February 16, 2004: Message edited by: Anu Ram ]

Read that again.

I am a Papad

HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404

posted

0

Originally posted by Anu Ram: The mathematician should say 6. The algorithm is to count the number of alphabets in the barman's number. Is that right?

That's right. I think Tanga pointed out that it ought to be "count the number of letters" to be more accurate for all possible numbers the barman uses. e.g. twenty has two "t's" , strictly speaking two letters but one alphabet. Knew what was meant though.

Anu Ram
Greenhorn

Joined: Feb 16, 2004
Posts: 8

posted

0

Yeah. It should be 'letters', not 'alphabets'. ok, here is a question: A jeweller has ten heaps of ten gold coins each. They are all of the same dimensions, and each coin is supposed to weigh 10 gms. But the goldsmith who sold it to the jeweller used impure gold to make the coins in one heap, and so each coin in this one heap weighs 11 gms. The jeweller can make use of his weighing scale just once. How does he find out which heap is bad?