Mr. S. and Mr. P. October 23, 2009

John McCarthy, who discovered Lisp, attributes this puzzle to Hans Freudenthal:

We pick two numbers a and b, so that 99 ≥ a ≥ b ≥ 2. We tell Mr. P. the product a × b and Mr. S. the sum a + b. Then Mr. S. and Mr. P. engage in the following dialog: Mr. P.: I don’t know the numbers. Mr. S.: I knew you didn’t know. I don’t know either. Mr. P.: Now I know the numbers. Mr. S.: Now I know them too. Find the numbers a and b.

Your task is to find the two numbers. When you are finished, you are welcome to read or run a suggested solution, or to post your solution or discuss the exercise in the comments below.