Interview Prep

Sum and Product Puzzle Answer: 4 and 13 [Solved]

Sum and product puzzle answer: two numbers 4 and 13 on a chalkboard with sum 17 and product 52

The sum and product puzzle answer is 4 and 13. Those two numbers add to 17 and multiply to 52. They are the only pair that survives all three lines of the dialogue. The rest of this post walks through the elimination, step by step. You will see exactly how two logicians narrow 2,352 possible pairs down to one.

The mathematician Hans Freudenthal first published it in 1969. Martin Gardner later named it the “Impossible Puzzle”. Today the sum and product puzzle is a fixture of quant interview question banks. It looks impossible because neither person is given enough information alone. The trick is that each line hands the other person new information. A strong candidate tracks what each line rules out.

The Sum and Product Puzzle

Two whole numbers, X and Y, are both greater than 1. Y is greater than X, and their sum is no greater than 100. S knows only the sum, X + Y. P knows only the product, X times Y. Both are perfect logicians. Both know all the rules above, and both always tell the truth. Then they speak:

  • S: “P does not know X and Y.”
  • P: “Now I know X and Y.”
  • S: “Now I also know X and Y.”

What are X and Y?

Before reading on, try it yourself. The answer is short, but the reasoning is the whole point. Interviewers care far more about how you get there than about the two numbers.

The Sum and Product Puzzle Answer in Three Steps

Start by counting the possibilities in the sum and product puzzle. The rules leave 2,352 possible pairs. X is greater than 1, Y is greater than X, and X + Y is no greater than 100. Each line of the dialogue cuts that list down. The cuts work in order. Here is how.

Step 1: What S’s First Line Rules Out

S says P does not know the numbers. For S to be sure of that, every pair adding to S needs an ambiguous product. P must not be able to pin any pair down at once. Some products give the game away at once. If the product is 2 times a prime, say 2 times 13, it factors in only one way. Then P would know the pair at once. The same holds for the product of two primes, such as 3 times 7. So a sum that splits into 2 plus a prime, or into two primes, cannot be the sum S holds.

That rules out every even sum. For any even sum, Goldbach’s conjecture splits it into two primes. The product of two primes factors in only one way, so P would have known the pair at once. Even the edge case, 6, fails. Its only pair is 2 and 4, and 8 factors only as 2 times 4. It also rules out any sum where the sum minus 2 is prime. That split gives a product of 2 times a prime.

A few more sums fall for a similar reason. 51, for example, splits into 17 and 34. 578 factors only as 17 times 34 once the pair 2 and 289 is excluded. That is because 2 plus 289 is over 100. Run those tests over every sum from 5 to 100. Ten survive: 11, 17, 23, 27, 29, 35, 37, 41, 47 and 53. The sum S holds is one of these ten.

Step 2: What P’s Reply Means

P now says: “Now I know X and Y.” P’s product must sit under exactly one of the ten surviving sums. Most products fail that test. Their factor pairs add to two or more surviving sums. Take 30. Its pairs are 2 and 15 (sum 17), 3 and 10 (sum 13) and 5 and 6 (sum 11). Sum 13 is already ruled out, so a product of 30 leaves P choosing between 11 and 17. But 52 is different. Its factor pairs are 2 and 26, which add to 28, and 4 and 13, which add to 17. Only 17 is on the surviving list. So P knows the sum is 17, and the numbers are 4 and 13.

A product of 50, for instance, comes from 2 and 25 (sum 27) or 5 and 10 (sum 15). Only 27 survives, so P would know the sum is 27. The point is that P’s line tells S the product is one of these decisive products. That is the clue S needs for the last line.

Step 3: What S’s Last Line Means

S now says: “Now I also know X and Y.” For that to be true, the sum S holds must contain exactly one decisive product among its pairs. If it contained two or more, S would still be guessing. So list the pairs for each surviving sum and count the decisive products. Only one sum has exactly one, and it is 17. Here are its seven pairs, and where each product shows up elsewhere:

Pair Product Also appears under
2 + 15 30 11 (5 + 6)
3 + 14 42 23 (2 + 21)
4 + 13 52 Nowhere else
5 + 12 60 23 (3 + 20)
6 + 11 66 35 (2 + 33)
7 + 10 70 37 (2 + 35)
8 + 9 72 27 (3 + 24)

Only 52 appears under a single surviving sum. Every other product in the table also turns up under 11, 23, 27, 35 or 37. So those pairs cannot be the one P holds. That leaves 4 and 13, with the sum 17 and the product 52. The dialogue closes, and the answer is forced.

Why 11 Is Not the Answer

The nearest miss in the sum and product puzzle is 11. It is the trap most candidates fall into. The pairs that add to 11 are 2 and 9, 3 and 8, 4 and 7, and 5 and 6. Their products are 18, 24, 28 and 30. Three of those products, 18, 24 and 28, sit under 11 alone. 18 factors only as 2 times 9 or 3 times 6, and 9 is not a surviving sum. 24 factors as 2 and 12, 3 and 8, or 4 and 6, and only 11 survives. 28 factors as 2 and 14 or 4 and 7, and only 11 survives.

So if S held 11, P could have known the sum from any of three products. Then S would have no way to tell which one P holds. The last line of the dialogue rules 11 out. The same test rules out every surviving sum except 17.

What the Interviewer Is Testing in the Sum and Product Puzzle

This puzzle is not an arithmetic test. The multiplication is trivial. Here is what the interviewer is actually watching for.

  • Reasoning about what other people know. Each line changes what the other person can deduce. Strong candidates track the knowledge state after every line, not just their own.
  • Systematic elimination. There are 2,352 pairs at the start. The winner cuts the list with rules, not guesses, and keeps the cuts in order.
  • Precision with the rules. The sum cap of 100 does real work. It is what kills the pair 2 and 289, and with it the sum 51. Candidates who ignore the cap lose the thread.
  • Clear communication. A good answer states each deduction and what it rules out, in order. If you can walk the interviewer through the three lines without skipping a step, you show you understand it.

Try This Next

If you liked this puzzle, try the camel bananas puzzle. A camel moves 3,000 bananas 1,000 km, and the answer is a three-stage relay. Then try the Goldman Sachs 4 cars puzzle. Four cars, four full tanks, and one question: how far can one car go?

Sources: the question is the classic Sum and Product Puzzle, first published by Hans Freudenthal in 1969. Martin Gardner named it the “Impossible Puzzle”. See the Wikipedia article on the Sum and Product Puzzle for the standard statement. The solution and all workings above are original. The pair counts were checked by brute force over all 2,352 pairs.

Enjoying this? Add StudyFromNotes as a preferred source on Google to see our latest notes and updates more often:

Leave a Reply

Your email address will not be published. Required fields are marked *