medium | general |

I guessed 3 natural numbers - $x, y, z$. You can ask me 2 sums of these numbers with any integer coefficients - $(a, b, c)$. That is, you give me a, b and c and I tell you the result of the expression $a*x+b*y+c*z$. Seeing the answer, you then give me the 2nd triplet of $(a,b,c)$ & I will tell $a*x+b*y+c*z$. Give me the algorithm to find $x$, $y$ and $z$.

If digits are small, we can solve any number of variables by asking $a=1, b=10^{100}, c=10^{200}$ etc. just by reading these numbers between the zeros of result.

Since they are natural numbers, if you knew the maximum number of digits any of them can have, say d, you could set a=1, b=10^d, c=10^2d, and you would be able to read the d-digit numbers directly. So, you use the first calculation to find the maximum number of digits, $(a,b,c)=(1,1,1)$. let $d =$ digits of this result $(x+y+z)$ Then, set $(a,b,c) = (1, 10^d, 10^{2d})$ Let the sum be $S$. Then $x =$ (first $d$ digits of $S$), $y = [d+1]$ to $2d$-digits of S, $z$ = $[2d+1$ to $3d]$ digits of $S$

Thus, we note that its posssible to solve for n natural numbers $x_1,x_2,...x_n$ with just $2$ questions.