Home > Riddles > Sum and product

Sum and product

It's a conversation that builds slowly, as only good logical problems do. Each sentence does not provide new information: it erases possibilities.

two different integers \(x\) and \(y\) satisfy \(2 \le x < y \le 99\). one mathematician is told the sum \(S=x+y\), and the other is told the product \(P=xy\). conversation:

  1. Product: “I do not know what the numbers are.”

2.

Sum: “I already knew that.”

  1. Product: “Then now I know.”

4.

Sum: “Then I know too.” Which are \(x\) and \(y\)?

Hints

Show hints
  1. Don't just look at the numbers; See what each interlocutor knows about the other's ignorance.
  2. The first sentence of Sum already eliminates some decompositions.
  3. The second of Product can only be understood after applying that first screening.

Solution

Show full solution

Answer:

$$ (x,y)=(4,13). $$ The dialogue works because each sentence eliminates an entire block of possibilities. We work in the domain $$

2\le x<y\le 99,

$$ and we call $$

S=x+y,\qquad P=xy.
$$ The first sentence, Product—“I don't know what they are”—just says that your product does not uniquely determine the pair. Until then there is nothing extraordinary. The second is the decisive one at the beginning: Sum claims that she already knew that Product could not know. That means that, for every possible decomposition of their sum,

$$ S=a+b, $$

the product $ab$ must admit more than one valid factorization in the interval. Because? Because if one of those decompositions were, for example, $(2,p)$ with $p$ prime, then the product would be $2p$ and Product could immediately identify the pair. Therefore, the sums supported by that phrase are only those that can never be written as $2+$ prime within the domain. When doing the complete sieve, there are exactly:

$$ \{11,17,23,27,29,35,37,41,47,53\}. $$ Now the third sentence comes in: Product, after hearing that, you can identify the pair. Then your product must have several factorizations at the beginning, but **only one** of them with sum belonging to the previous set. That happens with $$

P=52,

$$ because its valid decompositions are: - $(2,26)$, with sum 28; - $(4,13)$, with sum 17. And of those two, only 17 survive Sum's sifting. Therefore, upon hearing the second sentence, Product can already conclude that the pair is $$

(4,13).
$$ The fourth sentence remains to be verified: that Sum, knowing $S=17$, can also deduce the pair after listening to Product. The couples with sum 17 are:

$$ (2,15),(3,14),(4,13),(5,12),(6,11),(7,10),(8,9). $$ Their products are, respectively: $$

30,\ 42,\ 52,\ 60,\ 66,\ 70,\ 72.
$$ If Sum examines each one, he sees that all but 52 remain ambiguous even after the second sentence. On the other hand, 52 can only come from $(4,13)$ within the admitted sums. So the fourth sentence also fits. Therefore, the only pair compatible with the entire dialogue is:

$$ \boxed{(4,13)}. $$

Related riddles

Keep practicing

If you enjoyed this one, try more pure-logic riddles, explore this theme, browse the full archive, or read the riddle-solving guide.

← Previous: The bus of Conway · Next: The switches and the million of light bulbs →