This is a riddle forwarded to me from the BCAMT Math list-serve (originally by George Pólya, according to someone on the list-serve):

A Life Insurance agent comes up to a ladies door to sell her a policy. He asks her how many children does she have and what are their ages. She replies, I have three children, but I will not even listen to your sales pitch if you cannot guess their ages. (Assume all ages are whole numbers)

Here is clue number 1: The product of their ages is equal to 36.

Salesman jots down some figures and replies, “I do not have enough information to answer that yet”.

The lady replies, “Okay, here is clue number 2: If you go the house next door (points to it), the sum of their ages is the same as the house number”.

Salesman goes next door, looks at the number, jots down a few more things and then returns to say,” I still don’t have enough information”.

The lady then replies, “Okay, your third and final clue: My eldest is learning to play the piano!!”

The salesman, replied with the answer, it was correct, he gave his sales pitch, she bought a policy.

What were their ages?

The puzzle itself is interesting, but what I found more interesting is what happened next. Another mathematics teacher from the list-serve gave the question to some of their students, and got this response back:

“Couldn’t sleep, wrote a script that not only solved your problem, but solves it with any number of children, and any product of their ages, if possible. It also will generate numbers that will give you valid variations of this question, given the number of answers that you want.”

Script: https://gist.github.com/yasyf/5299301

This is a nice bit of mathematical reasoning by this student. They took a problem, solved it, and then found a way to generalize the problem, and solved the more general problem. You can’t ask for much more than that!