6. A mysterious machine contains a secret combination consisting of 2016 integers $x_{1}, \ldots, x_{2016}$. We know that all the numbers in the combination are equal except for one. It is possible to query the machine by submitting a sequence of 2016 integers $y_{1}, \ldots, y_{2016}$. The machine responds by revealing the value of the sum

$$
x_{1} y_{1}+\cdots+x_{2016} y_{2016} \text {. }
$$

After answering the first question, the machine accepts a second question, then a third, and so on. How many questions are necessary to determine the combination:

(a) knowing that the different number is equal to zero?

(b) not knowing which is the different number?
Solution: The answer to both requests of the exercise is two questions. To fully solve the exercise, it is enough to exhibit a method to determine the combination in two questions, and to show that, even knowing that the different number is zero, one question is not sufficient. For illustrative purposes, we will also give a simpler method to specifically solve point (a).

In the following, we will denote by $u$ and $d$ the values of the equal number and the different number, respectively, and by $t$ the index of the different number (i.e., $x_{t}=d$ and $x_{i}=u$ for $i \neq t$). Given a question $y_{1}, \ldots, y_{2016}$, observe that the answer is $\left(\Sigma-y_{t}\right) u+y_{t} d$, where $\Sigma$ denotes the sum of the numbers in the question $y_{1}+\cdots+y_{2016}$.

METHOD FOR POINT (a).

As the first question, we submit to the machine the numbers $1, \ldots, 1$. In this way, the machine will respond with $2015 u$, from which we can determine the value of $u$. Now we need to figure out the index $t$. The second question is $1,2,3, \ldots, 2016$. We get the answer $(\Sigma-t) u$, with $\Sigma=1+2+\cdots+2016$. Observing that $u$ cannot be zero (since the two numbers in the combination are different), it is immediate to determine $t$.

## ONE QUESTION IS NOT ENOUGH.

We need to show that for any possible question, there exist two different combinations that give the same answer. Consider a question $y_{1}, \ldots, y_{2016}$ (with sum $\Sigma$). If two of these numbers are equal to each other, $y_{i}=y_{j}$, then the two combinations that have the equal number 1 and the different number 0 in positions $i$ and $j$ respectively produce the same answer. Therefore, we can assume that the numbers in the question are all different. In particular, we can take $i \neq j$ such that $y_{i}$ and $y_{j}$ are different from $\Sigma$. Suppose the combination is $x_{i}=0$ and $x_{k}=\Sigma-y_{j}$ for $k \neq i$. The answer, then, would be $\left(\Sigma-y_{i}\right)\left(\Sigma-y_{j}\right)$. It is seen that the combination with $i$ and $j$ swapped ($x_{j}=0$ and $x_{k}=\Sigma-y_{i}$ for $k \neq j$) would give the same answer.

METHOD FOR POINT (b).

The first question is $1,-1,1,-1, \ldots$, and we call $R$ the answer. Observe that, denoting $\Delta=u-d$, we have $R=(-1)^{t} \Delta$. Now we choose the second question $y_{1}, \ldots, y_{2016}$ in such a way that:

(1) the numbers $R$ and $\Sigma=y_{1}+\cdots+y_{2016}$ are coprime (and $\Sigma$ is non-zero);

(2) the numbers $y_{i}(-1)^{i}$ are pairwise incongruent modulo $\Sigma$.

For example, these conditions are satisfied by choosing $y_{1}=1$ and $y_{i}=|R| i$ for $i>1$ (note that $\Delta \neq 0$, so $R \neq 0$). The answer we get, therefore, is

$$
R^{\prime}=\left(\Sigma-y_{t}\right) u+y_{t} d=\Sigma u-y_{t} \Delta=\Sigma u-y_{t}(-1)^{t} R \text {. }
$$

From this answer, we can deduce the class of $y_{t}(-1)^{t} R$ modulo $\Sigma$. Since $R$ and $\Sigma$ are coprime, the class of $y_{t}(-1)^{t}$ modulo $\Sigma$ is also uniquely determined. By construction, however, the numbers $y_{i}(-1)^{i}$ are pairwise incongruent modulo $\Sigma$, so knowing the class of $y_{t}(-1)^{t}$, we can deduce $t$. Knowing $t$, it is immediate to calculate $u$ from the equation for $R^{\prime}$ written above, then $\Delta$ from $R=(-1)^{t} \Delta$, and finally $d$.