# Sequence of Positive Integers Challenge

#### anemone

##### MHB POTW Director
Staff member
Consider the sequence of positive integers which satisfies $$\displaystyle a_n=a_{n-1}^2+a_{n-2}^2+a_{n-3}^2$$ for all $n \ge 3$.

Prove that if $a_k=1997$, then $k \le 3$.

#### Opalg

##### MHB Oldtimer
Staff member
Consider the sequence of positive integers which satisfies $$\displaystyle a_n=a_{n-1}^2+a_{n-2}^2+a_{n-3}^2$$ for all $n \ge 3$.

Prove that if $a_k=1997$, then $k \le 3$.
The statement of the problem implies that the first three terms $a_0$, $a_1$, $a_2$ can be chosen arbitrarily, and the rest of the sequence is then determined by the given relation.

Suppose (to get a contradiction) that $a_k = 1997$ for some $k\geqslant4$. Let $x=a_{k-4}$, $y=a_{k-3}$, $z=a_{k-2}$. Then $a_{k-1} = x^2 + y^2 + z^2$, and $1997 = y^2 + z^2 + (x^2+y^2+z^2)^2$. Since $1997 < 45^2$, it follows that $x^2 + y^2 + z^2 \leqslant 44$, and since $44<7^2$ it follows that each of $x$, $y$, $z$ must be at most $6$. Thus $(x^2+y^2+z^2)^2 = 1997 - y^2 - z^2 \geqslant 1997 - 6^2 - 6^2 = 1925 >43^2$, and it follows that $x^2+y^2+z^2 >43$. Thus the only possibility is that $x^2+y^2+z^2 = 44$. But the only way to express $44$ as the sum of three squares is $44 = 6^2+2^2 + 2^2$, and neither of the sums $2^2 + 2^2 + 44^2$, $2^2 + 6^2 + 44^2$ is equal to $1997$ (obviously, since both those sums will be even). Therefore $1997$ cannot be equal to $a_k$ for any $k>3$.

In fact, it is possible to get $1997 = a_3$, for example if $a_0 = 5$, $a_1 = 6$, $a_2 = 44$, then $a_3 = 25 + 36 + 1936 = 1997$.