# The BarTenders Kids

HS Thomas

Ranch Hand

Posts: 3404

posted 12 years ago

===========================

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 ]

**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 ]

posted 12 years ago

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 ]

;-)

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

Jim Yingst

Wanderer

Sheriff

Sheriff

Posts: 18671

posted 12 years ago

I think we need to assume that

all ages are integers 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.

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

Posts: 3404

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

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.

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

Sheriff

Posts: 18671

posted 12 years ago

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.

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.

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

Jim Yingst

Wanderer

Sheriff

Sheriff

Posts: 18671

HS Thomas

Ranch Hand

Posts: 3404

posted 12 years ago

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?

What is the counter sign?

Anu Ram

Greenhorn

Posts: 8

posted 12 years ago

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 ]

[ February 16, 2004: Message edited by: Anu Ram ]

ChanSan Mehbubani

Ranch Hand

Posts: 108

HS Thomas

Ranch Hand

Posts: 3404

posted 12 years ago

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.

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

Posts: 8

posted 12 years ago

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?

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?

Bert Bates

author

Sheriff

Sheriff

Posts: 8900

5

It is sorta covered in the JavaRanch Style Guide. |