[Math] The Impossible puzzle (“Now I know your product”)

puzzle

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

Best Answer

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

Related Question