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.

I am trying to figure out this impossible problem by Martin Gardener and still havent found a suitable solution or link to it

Two mathematicians S and P are discussing two unknown integers, both greater than 1. S knows only the sum of the numbers, whereas P knows only their product.:

S: "I see no way you can determine my sum." P (after a suitable delay): "That didn't help me. I still don't know your sum." S (after another delay): "Now I know your product." What are the two numbers?

I have seen the answers on the xkcd wiki link for this at http://wiki.xkcd.com/irc/Talk:Puzzles#The_Sam_And_Polly_Problem say 13 and 16 and it checks out mathematically but then there are more ambiguous responses and most of the attempts seem brute force rather than logic.

My question is two fold

  1. How to solve this problem logically?

  2. Are there more answers then 13,16 or this answer is the only one even as the upper bound k(upper bound on answer) shifts higher

share|improve this question
You forgot the hypothesis: $3 \leq x \leq y \leq 97$. –  Sigur Jul 1 '12 at 13:48
See people.sc.fsu.edu/~jburkardt/fun/puzzles/impossible_puzzle.html (and the link to solutions at the bottom of the page). –  Hans Lundmark Jul 2 '12 at 6:46
add comment

1 Answer

up vote 2 down vote accepted

Let $x,y$ be integers greater than $1$, $P=xy$ and $S=x+y$.
Write $P=x_1\cdots x_n$, product of not necessarily distinct primes. If $n=2$, then necessarily $S=x_1+x_2$, so, if $S$ isn't the sum of two primes (this case), knowing $P$ tells nothing about $S$.
Then, we know that $n\ge 3$ and $S$ isn't the sum of two primes ($S$ isn't even, in particular, and then necessarily $P$ is even.).

So, necessarily $x$ is even and $y$ is odd. If we write $P=2^k p_1$, where $p_1$ is any prime, then necessarily $x=2^k$ and $y=p_1$, so, in this case $S$ would be known. Then, in this case, $P=2^k p_1\cdots p_m$, with $m>1$ and $p_i$ prime (since in this case knowing $P$ tells nothing about $S$).

So $S$ is odd and the set $\{xy:x+y=S,x,y>1\}$ contains one and only one number of the form $P=2^kp_1\cdots p_m$, with $p_i$ prime and $m>1$.


In your link, the statement is a little different:

Sam (to Polly): "You can't know what x and y are."
Polly (to Sam): "That was true, but now I do."
Sam (to Polly): "Now I do too."

So, in this case we have $S$ odd, isn't the sum of two primes, and the set $\{xy:x+y=S,x,y>1\}$ contains one and only one number of the form $2^kp$, with $p$ odd prime, $k>1$, and $P=2^kp$, $x=2^k$, $y=p$. This excludes several possibilities and the rest is brute force (and we need an upper bound for $x$ and $y$).

share|improve this answer
Why can't $S$ be a sum of two primes? Either way, aren't you assuming Goldbach's conjecture? –  tomasz Jul 1 '12 at 15:04
He means $P$ is not the product of two primes. –  N. S. Jul 1 '12 at 15:20
@tomasz: oopss... I assumed Goldbach's conjecture... (but if we have an upper bound for $x$ and $y$, then it's proved =p (by brute force... =p)). And if $S$ was the sum of two primes, then Polly would know $S$, which doesn't happen. –  Yuki Jul 1 '12 at 15:38
@Yuki: it could be the sum of two primes whose product isn't $P$. –  tomasz Jul 1 '12 at 15:47
@tomasz: but if $S$ is the sum of two primes, then Sam would say "Maybe you know what $x$ and $y$ are", since in this case one of the possibilities is $P$ be the product of two primes, and if $P=p_1p_2$, $p_1,p_2$ primes, then necessarily $x=p_1$ and $y=p_2$, cause $x,y>1$. –  Yuki Jul 1 '12 at 21:25
show 1 more 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.