A colleague of mine recently messaged me a riddle. It is about a deduction process between two perfect logicians.
The riddle is as follows:
A person writes two non-zero digits on a paper. He tells person A the product of the digits, and person B the sum of the digits. The both persons have the following conversation:
A: "I don't know the digits"
B: "I don't know the digits"
A: "I don't know the digits"
B: "I don't know the digits"
A: "I don't know the digits"
B: "I don't know the digits"
A: "I don't know the digits"
B: "I don't know the digits"
Then person A says "I know the digits"
From this conversation I'm supposed to obtain the digits which were written. I can express this as a mathematical statemente but I lack the idea of how to deduce this riddle.
I know that the first person chose two numbers $x,y\in [9]:=\{1,\cdots,9\}$ and that person A knows $x+y$ and person B knows $xy$. If $x,y$ are different then $x+y \le 17$ and $xy\le 72$. Otherwise, $x+y\le 18$ and $xy\le 81$.
Now I think I must search for numbers below 81 such that any of $[9]$ divides. Definitely any prime is not such a number and I'm sure there are a couple more. Also, for numbers below 18, it is possible to count the partitions of each number reducing the number of cases which $x,y$ can meet.
I think that this is not a correct approach to this problem and I would like to hear a good approach, albeit without giving the complete answer if possible. Also if there is anything wrong with my reasoning, please tell me so I can correct it.
We may suppose that $x\ge y$.
A: "I don't know the digits", so we see that $(x,y)$ is either of the followings where red numbers, green numbers represent $xy,x+y$ respectively :
$\qquad\qquad\qquad$
B: "I don't know the digits", so we see that $(x,y)=(2,2),(9,4),(6,6)$ were impossible since each of $\color{green}{4,12,13}$ appears at only one place.
A: "I don't know the digits", so we see that $(x,y)=(4,1)$ was impossible since $\color{red}{4}$ appears at only one place.
B: "I don't know the digits", so we see that $(x,y)=(3,2)$ was impossible since $\color{green}{5}$ appears at only one place.
A: "I don't know the digits", so we see that $(x,y)=(6,1)$ was impossible since $\color{red}{6}$ appears at only one place.
B: "I don't know the digits", so we see that $(x,y)=(4,3)$ was impossible since $\color{green}{7}$ appears at only one place.
A: "I don't know the digits", so we see that $(x,y)=(6,2)$ was impossible since $\color{red}{12}$ appears at only one place.
B: "I don't know the digits", so we see that $(x,y)=(4,4)$ was impossible since $\color{green}{8}$ appears at only one place.
A: "I know the digits", so we see that $(x,y)=(8,2)$ was possible since $\color{red}{16}$ appears at only one place, and that $(8,1),(9,1),(4,2),(9,2),(3,3),(6,3),(8,3),(6,4)$ were impossible since if $(x,y)$ were either of them, then A would have said "I don't know the digits").
It follows that the written digits are $2$ and $8$.