Person A and Person B communicate to figure out the numbers

85 Views Asked by At

This is a problem I've encountered and solved a long time ago. At the time I found it in a YouTube comment. Now, years later, I can't by any means find this problem. Memory is sketchy, but the problem sounds something like this:

Two positive integers, x and y, both less than 20.
Person A knows their sum.
Person B knows the sum of their squares.
Both persons communicate in order to figure out what x and y are without sharing information about the sums. The conversation goes as follows:
-Person A: I don't know what x and y are.
-Person B: I don't know what x and y are.
-Person A: I don't know what x and y are.
-Person B: I don't know what x and y are.

(etc... this goes on for a few more lines until eventually...)
-Person B: Now I know what x and y are.
-Person A: Now I as well know what x and y are.*

Note: I don't know the exact number of times the two persons repeat "I don't know what x and y are". I'm also not sure which of the two persons figures out the numbers first.

Bulk of the question: I'm looking for the whole problem, a piece of text that is solvable as is, with the correct/exact parameters. Also does the problem have a name? Some history or trivia behind it would also be preferable. Is there a way to solve this problem other than the method described below? Extra: Can this problem be solved in general for any x,y less than n?

[Spoiler Alert] If it helps to pinpoint the exact puzzle, here's how I solved it:
The point of the conversation is for each of the two persons to figure out the other's sum without directly sharing it. I drew up, for every combination of x and y, a table for their sum and another for the sum of their squares. In each table there are equal sums for different values of x and y, and other sums are unique(they correspond to a specific set of x and y). For each time a person says he doesn't know the numbers, it means that the sum that he knows has multiple solutions, therefore we can eliminate any sum that is unique. For example if person B doesn't know the numbers x and y, then 25 can be eliminated from his table, because if it were 25 he would've known x=3 and y=4. You can analyse information from both tables simultaneously until eventually each table contains one possibility that corresponds to the values of x and y.

1

There are 1 best solutions below

0
On

These are all variants on the Sum and Product Puzzle