The following story took place in the Soviet Union, where children started their studies at school at the age of 7. It is important to know this for the solution of the problem.

Two mathematicians who hadn?t seen each other for years met in the park and had the following conversation:

?Hi! How are you? Do you already have kids??

?Hi! I?m fine, thanks! Yes, I have two kids, both of them are still preschoolers.?

?How old are they??

?The product of their ages is the number of pigeons around that bench.?

?Hmm. I don?t have enough information to learn their ages.?

?The older takes after his mother.?

?Oh, now I see!?

**Question:** What is the age of the children?

I have to admit that when I was given this problem in my teenage years, I wasn?t able to solve it. When I gave up, I was given a hint: ?The order of the phrases in the dialogue is important?. This allowed me to solve the problem within minutes. I am not publishing the solution, but instead, I?ll present a set of similar problems below the statements of which can also be used as a hint. Feel free to share and discuss the solution in the comment section though.

Many years after I was given this problem, I learned that it is a simplification of a much harder mathematical puzzle. Here it is.

Alice thought of two distinct numbers, both bigger than 1. She told the sum of the numbers to Sam (this sum appeared to be smaller than 100) and their product to Peter. Then the following conversation between Sam and Peter occurred:

?I know that you don?t know the numbers which Alice thought of,? told Sam to Peter.

?Now I know them,? Peter answered.

?Now I know them too,? said Sam.

**Question:** What are Alice?s?numbers?

This problem is much harder than the puzzle with children?s ages stated above. I was able to solve it only by writing a program which enumerated all of the possibilities, but I know that many people do it manually using simple arithmetic tricks and tedious bookkeeping. If you cannot solve the problem yourself you can check the solution in Wikipedia. Note that the condition for the sum of Alice?s numbers to be less than 100 is critical. It is clear that a too wide range would make the solution non-unique, but what is interesting is that if the range is too small (if the sum is less than 62) the solution also cannot be found. It is quite difficult and instructive to analyze how the number of solutions depends on the allowed range for the sum.

If this problem still appears too difficult, you can also check ?Cheryl?s Birthday? problem from Asian Schools Maths Olympiad. It is just another variation of the same problem of less complexity. (It seems that this is the easiest version of all known to me).

There is one more modification of the same problem which is my favorite.

Alice made up three positive natural numbers. She told the sum of these numbers to Sam and the product of these numbers to Peter. Then the following conversation happened:

?If only I knew that the number which you were given is bigger than the number which I was given, then I?d be able to immediately tell what numbers Alice made up?, said Sam.

?No, the number which Alice told me is smaller than yours, and I know all of the numbers?, Peter responded.

**Question:** What numbers did Alice make?

This problem is not as immediately straightforward as the problems above, although it is much easier computationally. Once again I am not providing the solution, but you can discuss it in the comments section.

For the reference, the answer to the last problem is numbers 1, 1 and 4. It is quite easy to find these numbers, but you should also be able to demonstrate clearly that these numbers are the only solution which is possible. This problem was given in one of the Russian Math Competitions (unfortunately, I?ve lost the reference) and if the correct answer was given, but the uniqueness of the solution wasn?t shown, the solution wouldn?t count.