Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

share|improve this question
I suspect your question is slightly inaccurate based on mathematik.uni-bielefeld.de/~sillke/PUZZLES/logic_sum_product –  picakhu Nov 17 '11 at 15:59
@picakhu: What's inaccurate? Looks like the same question to me. –  joriki Nov 17 '11 at 16:01
@joriki, its 4 statements vs 3. The first statement is important. –  picakhu Nov 17 '11 at 16:05
This is well known –  Marc van Leeuwen Nov 17 '11 at 16:05
My favorite version of this problem, with a unique solution (unlike the OP's version), is the "Mediterranean version", which I read in this paper: A teacher says to students $P$ and $S$: "I've secretly chosen two positive integers $x$ and $y$ with $x \le y$. I've told their sum $s=x+y$ only to $S$, and their product $p=xy$ only to $P$." $S$ then says to $P$, "You can't determine $s$", to which $P$ replies, "In that case $s=136$". Determine $x$ and $y$. –  r.e.s. Nov 17 '11 at 18:03
show 3 more comments

3 Answers

up vote 1 down vote accepted

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) {
        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 + 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)$.

share|improve this answer
add comment

A reference:
A. K. Austin, "A calculus for know/don't know problems" Mathematics Magazine Vol. $49$, No. $1$, Jan., 1976

share|improve this answer
add comment

I think I found two different solutions to this problem:



I believe these are all possible solutions to the problem as stated.

joriki, are these not valid solutions? If so, could you explain why?

share|improve this answer
If we bound the problem by requiring that the sum is less than 100 and remove the restriction that the numbers are less than 21, only (4,13) is a solution. The less than 21 restriction makes (16,19) an additional solution. –  Brian Dec 1 '11 at 2:58
(4, 13) is not a solution because the second player knows the sum is 17, since there is a unique factorization of 52 into two factors in {2, ..., 20}. Similarly with (16, 19). –  Charles Dec 1 '11 at 21:11
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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