Solution:
The answer to both requests of the exercise is two questions. To completely solve the exercise it suffices to exhibit a method for determining 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 solve specifically part (a).
In what follows, we will denote by u and d the values of the equal number and of the different number respectively, and by t the index of the different number (that is, xt=d and xi=u for i=t). Given a question y1,…,y2016, we observe that the answer is (Σ−yt)u+ytd, where Σ denotes the sum of the numbers of the question y1+⋯+y2016.
METHOD FOR PART (a).
As the first question, we submit to the machine the numbers 1,…,1. In this way the machine will answer 2015u, from which we can obtain the value of u. Now we still need to figure out what the index t is. The second question is 1,2,3,…,2016. We obtain the answer (Σ−t)u, with Σ=1+2+⋯+2016. Observing that u cannot be zero (because the two numbers of the combination are different), it is immediate to obtain t.
ONE QUESTION IS NOT ENOUGH.
We must show that for every possible question there exist two different combinations that give the same answer. Consider a question y1,…,y2016 (with sum Σ). If two of these numbers are equal to each other, yi=yj, then the two combinations that have equal number 1 and different number 0 in position i and j respectively produce the same answer. Hence we may assume that the numbers of the question are all different. In particular, we can take i=j such that yi and yj are different from Σ. Suppose that the combination is xi=0 and xk=Σ−yj for k=i. The answer, then, would be (Σ−yi)(Σ−yj). One sees that the combination with i and j swapped (xj=0 and xk=Σ−yi for k=j) would give the same answer.
METHOD FOR PART (b).
The first question is 1,−1,1,−1,…, and we call R the answer. We observe that, setting Δ=u−d, we have R=(−1)tΔ. Now we choose the second question y1,…,y2016 in such a way that:
(1) the numbers R and Σ=y1+⋯+y2016 are coprime (and Σ is nonzero);
(2) the numbers yi(−1)i are pairwise non-congruent modulo Σ.
For example, these conditions are satisfied by choosing y1=1 and yi=∣R∣i for i>1 (note that Δ=0, hence R=0). The answer that we obtain, then, is
R′=(Σ−yt)u+ytd=Σu−ytΔ=Σu−yt(−1)tR.
From this answer we can deduce the class of yt(−1)tR modulo Σ. Since R and Σ are coprime, the class of yt(−1)t modulo Σ is also uniquely determined. By construction, however, the numbers yi(−1)i are pairwise non-congruent modulo Σ, consequently, knowing the class of yt(−1)t, we can deduce t. Once t is known, it is immediate to compute u from the equation for R′ written above, then Δ from R=(−1)tΔ, and finally d.