Mathematician: "It was the August of 1997 when they barged into my house..." - Here is his story:

Students surprised their mathematics teacher with a cake on his birthday. The teacher was delighted when he noticed that every single year of his life is accounted for with a candle. He repeatedly tried to blow out the candles, but he never got all of them. Eventually, he gave up and said: "The youngest of my children, my youngest son, had more luck on his birthday cakes!". One of the students followed up: "How many children do you have and how old are they?"

The teacher decided it is time for a riddle: "The product of their ages is equal to the total number of candles on the cake, while the sum of their ages is equal to the number of candles still left burning on the cake. What can you tell me about my children?"

The students took some time and eventually replied: "We don't know their ages, but we do know that you don't have twins among your children."

The teacher added: "Oh, I forgot to mention that the age of my youngest son is not a cube number."

They replied: "We now know their exact ages!"

Question. What are the ages of the children?

  • $\begingroup$ When the students say "We don't know their ages...", could that mean they know some but not all of the children's ages, or does it mean that they know none of their ages? $\endgroup$ Commented Aug 11, 2020 at 20:49
  • $\begingroup$ @JohnathanAshley None. $\endgroup$
    – Vepir
    Commented Aug 11, 2020 at 21:20
  • $\begingroup$ So he doesn't ever answer even how many children he has? $\endgroup$ Commented Aug 11, 2020 at 22:03
  • $\begingroup$ @AnthonyIngram-Westover He doesn't directly give that information. Still, the number of children and their ages can be deduced by the end of the puzzle. $\endgroup$
    – Vepir
    Commented Aug 11, 2020 at 22:08
  • 1
    $\begingroup$ Do the students know that the youngest son is also the youngest child? I could only find an answer if I can make that assumption. $\endgroup$
    – Bass
    Commented Aug 11, 2020 at 22:25

2 Answers 2


After trying some

highly divisible numbers (to be able to combine the factors in many different ways) as the teachers age, and Very Tediously checking the sums of the possible combinations,

I managed to find at least one possible solution:

The kids are 2, 3, and 12.

This would make for the following deductions:

- The product is $72$ and the sum is $17$.
- The prime factors of $72$ are $2$, $2$, $2$, $3$, and $3$.
- There are quite many possible combinations that can be made from these, and the optional $1$, which doesn't affect the product. Checking them all reveals that..
- There are only two ways the factors can be combined so that the sum becomes $17$: $\lbrace2,3,12\rbrace$ and $\lbrace8,9\rbrace$.
- This allows the students to deduce that there are no twins, even though they cannot be certain of any particular age being present.
- Finally, "youngest child's age isn't a cube" rules out the latter option.

This gives a conceivable age for the teacher, somewhat high but by no means impossible age for getting the last child (the teacher was referred to as a "he"), his age explains why the candles were too many to blow out, and the youngest child has also had more than one birthday, as implied.

  • $\begingroup$ It is possible to show that the possibility you found, is the only possibility. $\endgroup$
    – Vepir
    Commented Aug 11, 2020 at 22:35
  • 2
    $\begingroup$ Yeah, probably, but it's way past my bedtime, and I can't think of any neat proof; seems like it's necessary to enumerate all the possible combinations of lit and extinguished candles and show that none of them works. $\endgroup$
    – Bass
    Commented Aug 11, 2020 at 22:58
  • $\begingroup$ Some enumeration is probably unavoidable, but not all numbers need to be checked. We can eliminate most numbers and we can also eliminate individual factorizations within other numbers. For example, factorizations that contain one $4$ or two $2$'s are not worth checking, because $2+2=2\cdot2=4$ guarantees at least two sets of factors that will sum to the same sum, but one of those sets contains two $2$'s which are twins (but students know there are no twins). $\endgroup$
    – Vepir
    Commented Aug 12, 2020 at 13:21
  • $\begingroup$ @Vepir yeah, that's what I initially figured out too, and that's how I found the solution. Ruling out every possible combination is unrewarding drudgework though, and more suitable for scientific articles than a PSE answer. $\endgroup$
    – Bass
    Commented Aug 12, 2020 at 20:53
  • $\begingroup$ It is actually not that many combinations if you set up the proper diophantine problem, but yes, the remainder of this is now either a rigorous math problem or a drudgework of eliminating all the combinations. Perhaps I should've made the puzzle centered around more logical deductive components rather than around a number theory problem. $\endgroup$
    – Vepir
    Commented Aug 12, 2020 at 21:02

I'll "strip" the problem to pure mathematical context:

Given product and sum of some positive integer numbers it's impossible to tell what the numbers are, but it's possible to tell that none of them are equal -- unless it's given that the least number is not a perfect cube -- then it's possible to tell what the numbers are.
What are the numbers?

Also we assume that the product of the numbers is not more than $200$ (for sure, it's the professor's age).

So we consider two totally different possibilities (not much of a spoiler):

The numbers can contain $1$ or not. In other words, it's not clear from the problem whether can $1$ year old child can blow a burning candle or not.

There can be some $1$s. Although we have then $12293$ possibilities for (product,sum) with $65118$ possibilities of what the numbers are, there are only $10$ cases satisfy "can't tell, but can tell there's no pairs":
$(6,6):\ 6=3\cdot 1\cdot 2$
$(30,11):\ 3\cdot 1\cdot 5\cdot 2=6\cdot 5$
$(42,13):\ 6\cdot 7=3\cdot 1\cdot 7\cdot 2$
$(66,17):\ 3\cdot 1\cdot 2\cdot 11=11\cdot 6$
$(78,19):\ 6\cdot 13=3\cdot 1\cdot 2\cdot 13$
$(102,23):\ 3\cdot 17\cdot 2\cdot 1=6\cdot 17$
$(114,25):\ 6\cdot 19=3\cdot 1\cdot 2\cdot 19$
$(138,29):\ 3\cdot 1\cdot 23\cdot 2=6\cdot 23$
$(174,35):\ 3\cdot 1\cdot 29\cdot 2=6\cdot 29$
$(186,37):\ 6\cdot 31=3\cdot 31\cdot 2\cdot 1$
from every of them $6$ isn't a cube and $1$ is, so it's not so interesting as we can't exactly say which of them is guessed in the problem -- any can be (i.e. above is the solution set, nothing else fits).

$1$s are not allowed, then $745$ total (product,sum) pairs, $897$ possibilities of what the numbers are, but only two of them fit:
$(72,17):\ 3\cdot 12\cdot 2=9\cdot 8$
$(84,19):\ 14\cdot 3\cdot 2=12\cdot 7$
but the latter has no cubes, thus the former is the solution and the children ages are $2,\,3,\,12$,

as mentioned in the Bass's answer. Only the difference is that I have python script to show it rigorously than no other possibilities left.

  • $\begingroup$ Factorizations containing $1$ do not need to be checked (first section of the story says the youngest child had multiple birthdays i.e. "cakes" as a plural word.) Also, only a small amount of possible ages needs to be checked. (See my second comment on the Bass's answer). $\endgroup$
    – Vepir
    Commented Aug 12, 2020 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.