My oldest plays the piano!

Two old friends, Ernie and Bernie, bump into each other in the street.  It was more than twenty years since their last meeting, so they decide to spend some time together in a nearby bar, chatting about their lives.  At some point, Bernie asks the inevitable: “So, you got married?”

“Well, yes!”—claims enthusiastically Ernie. “And I have three beautiful children!”

“That’s great, Ernie! And how old are your kids?”—enquired Bernie.

“I know you are a sucker for puzzles, Bernie, so I will let you figure it out through a few clues.  You should not have any trouble getting it.  First clue: If you add the ages of my kids, the result is thirteen

“Whoa!  That doesn’t help me much, does it?”—complains Bernie. “Couldn’t you give me another clue?”

“Sure, a second clue: If you multiply their ages together, the result is the same as how much we payed for these beers”

Bernie scratches his head for a minute, and cannot figure it out yet… Before he complains again, Ernie realizes the mistake, apologizes, and offers Bernie the last clue: “My oldest plays the piano!”

Bernie had no trouble finding the ages of the children this time.

These are all the possible combinations of positive integers x, y, z that add up to thirteen, together with their product:

\begin{array}{|c|c|c||r|} \hline x&y&z& x\cdot y \cdot z \\ \hline 1&1&11&11 \\ \hline 1&2&10&20 \\ \hline 1&3&9&27 \\ \hline 1&4&8&32 \\ \hline 1&5&7&35 \\ \hline 1&6&6&\mathbf{36} \\ \hline 2&2&9&\mathbf{36} \\ \hline \end{array} \begin{array}{|c|c|c||r|} \hline x&y&z& x\cdot y \cdot z \\ \hline 2&3&8&48 \\ \hline 2&4&7&56 \\ \hline 2&5&6&60 \\ \hline 3&3&7&63 \\ \hline 3&4&6&72 \\ \hline 3&5&5&75 \\ \hline 4&4&5&80 \\ \hline \end{array}

Notice that there are only two combinations that offer the same product: (x,y,z) = (1,6,6) and (x,y,z) = (2,2,9).  The fact that Bernie did not know the answer to the riddle after the second clue, indicates that none of the other possibilities is right.  He thus needs a third clue to decide between the two choices above.

I would not think of stealing the pleasure to solve the puzzle to my reader.  What are the ages of Ernie’s children?


With the aid of WolframAlpha, one should be able to find quickly all the intermediate steps to the solution.  One must be careful, nevertheless, to input the right expressions.  For example, the reaction of WolframAlpha to the query “all integer solutions to a+b+c=13 && a>0 && b>0 && c>0 && a<14 && b<14 && c<14” offers only one (insufficient) possibility:

A better way to go about it is, for example, to generate the solutions in python. A possible script to obtain the solutions would look like this:

for a in range(1,14):
for b in range(a,14):
for c in range(b,14):
if (a+b+c==13):
print ‘%6s %6s %6s %6s’%(a,b,c,a*b*c)
1 1 11 11
1 2 10 20
1 3 9 27
1 4 8 32
1 5 7 35
1 6 6 36
2 2 9 36
2 3 8 48
2 4 7 56
2 5 6 60
3 3 7 63
3 4 6 72
3 5 5 75
4 4 5 80


  1. Loreta Dylgjeri
    November 14, 2010 at 9:35 am

    Thank you so much for all your help!

  2. David Ritterskamp
    June 17, 2011 at 6:13 am

    I never liked this question. Even if you have two children that are both 6, that does not preclude one from being older than the other. Twins are often identified as the “older” sibling and the “younger” one. You could even have a situation where the two children were born 11 months apart, the oldest is 6 years 11+ months and the other having just turned 6.

    • June 17, 2011 at 4:40 pm

      Indeed! As a matter of fact, if you decide not to follow the convention for stating one’s age, then the condition “the oldest plays the piano” will not make sense at all!

      I am cooking up a generalization of that problem. Here is a sneak preview:

      (1) Ages are given as strictly positive real numbers (think floating point) at a given time. Say, one of the kids was 5.874235345298452093845234908 years-old at 5.00pm EST on June 17, 2011.

      (2) Children are allowed to come from different mothers. That way, it is possible to have two or more kids with exactly the same age.

      Even with these constraints, the problem will make sense and, instead of being solved with traditional integer handling, one would have to set it as optimization. Cool, huh?

      I will post something about it soon. Thanks a lot, David!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: