Recreational Mathematics – Two Numbers, Two Mathematicians Puzzle

puzzlerecreational-mathematics

This is one of the most beautiful and difficult puzzles I have encountered. I have talked to several people, but I still don't know the solution – I do however know that the solution exists.

Someone imagined two positive whole numbers. Both numbers are greater than $1$, and less than $21$. That person tells the sum of those two numbers to mathematician A, and the product of those two numbers to mathematician B. Couple of days later, A and B talk to each other:

A: There is no way for you to find the sum.
B: But I know the sum now!
A: And now I know the product.

Which two numbers have person imagined?

Best Answer

There is in fact no solution to this puzzle. Martin Gardner realized this after presenting it in Scientific American:

'As hundreds of readers have pointed out, the "impossible problem" given in this department for December turned out to be literally impossible.' (For this quote and an explanation, see here.)

For the puzzle to have a solution, there would have to be an admissible sum such that no matter how it is split up into two admissible addends, the resulting product also has at least one other admissible factorization. The following short Java program checks that there is no such admissible sum.

public class SumAndProduct {
    final static int min = 2;
    final static int max = 20;

    public static void main (String [] args) {
        outer:
        for (int sum = min + min;sum <= max + max;sum++) {
            for (int i = min;i <= max;i++) {
                int j = sum - i;
                int product = i * j;
                int nfactorizations = 0;
                for (int a = min;a <= max;a++) {
                    int b = product / a;
                    if (min <= b && b <= max && a * b == product)
                        nfactorizations++;
                }
                nfactorizations = (nfactorizations + 1) / 2;
                if (nfactorizations == 1)
                    continue outer;
            }

            System.out.println ("sum " + sum + " can't be determined");
        }
    }
}

Note that the solution $(2,6)$ given on this page linked to by picakhu is incorrect. The sum is $8$, which could be the result of $(3,5)$, which has the unique factorization $3\cdot5$ that would allow B to deduce the sum $8$. The solution originally claimed by Martin Gardner was $(4,13)$.