When are eight integers entirely determined by their pairwise sums? Alice picks 8 numbers, which are not necessarily different. Once she has picked them, she writes out the addition of all the pairs on a piece of paper, which she gives to Basil. Basil wins if he can guess correctly the original n numbers, which Alice chose. Can Basil be certain that he will win?
After a lot of trial and error I found the case where Alice picks the numbers $1,5,7,9,12,14,16,20$ which have the same pairwise sums as the numbers $2,4,6, 10,11,15,17,19$. However the trial and error method is extremely laborious and tedious. Is there a more mathematical approach, which can immediately give you the solution?
 A: Hint: if the collections $(a_1, \dots, a_k)$ and $(b_1, \dots, b_k)$ have identical pairwise sums, then the collections $(a_1, \dots, a_k, b_1+m, \dots, b_k+m)$ and $(b_1, \dots, b_k, a_1+m, \dots, a_k+m)$ also have identical pairwise sums. (The number $m$ has to be such that $a_i \neq b_j \pm m$ for all $i,j$, so that the numbers in each collection would be different.)
A: This is related to the Turnpike problem. A standard solution to that problem is to factor the generating function. Here it at least gives an equivalent reformulation of your problem, though factoring is useless unfortunately. Let $A = \{1,5,7,9,12,14,16,20\}$ and $B = \{2,4,6,10,11,15,17,19\}$.
Let $A(x) = \sum_{a \in A} x^a = x^1 + x^5 + x^7 + x^9 + x^{12} + x^{14} + x^{16} + x^{20}$ and $B(x) = \sum_{b \in B} x^b$ be the corresponding generating functions. Note that
$$A(x)^2 = \sum_{a_1, a_2 \in A} x^{a_1 + a_2}$$
so that if $A = \{a_1, \ldots, a_m\}$, then
$$A(x)^2 - A(x^2) = 2\sum_{i < j} x^{a_i + a_j}$$
encodes the pairwise sums. Saying the pairwise sums are the same is hence precisely saying
$$A(x)^2 - A(x^2) = B(x)^2 - B(x^2).$$
The question then reduces to: for a given Laurent polynomial $A(x) \in \mathbb{Z}_{\geq 0}[x, x^{-1}]$, are there any Laurent polynomials $B(x) \in \mathbb{Z}_{\geq 0}[x, x^{-1}]$ with $A(x)^2 - A(x^2) = B(x)^2 - B(x^2)$? I think you'd naturally say "yes, in general there will be, maybe once in a while there won't be".
