I need to prove this result for something I am working on:
For any positive integer $n$, is it possible to find a nonzero integer $p$ so that $p^2$ is the sum of $i$ nonzero squares for all $1 \leq i \leq n$?
What I'd like to do is as follows. First find $a,b,c$ nonzero integers so that $a^2 + b^2 = c^2$. Then find a nonzero integers $d$ and $e$ so that $c^2 + d^2 = e^2$. Then find nonzero integers $f$ and $g$ so that $e^2 + f^2 = g^2$. Note that then $$ g^2 = e^2 + f^2 = c^2 + d^2 + f^2 = a^2 + b^2 + d^2 + f^2 $$ and I'd like to continue in this way. However, I am wondering if this construction is even possible? Am I always guaranteed that such a string of integers exist? If so, how do I prove this rigorously? Another thought of mine is use Euclid's Formula. For example, let $m = 3$ and $n = 1$. Then $$ \begin{align*} a &= 3^2 - 1^2 = 8\\ b &= 2\cdot 3 \cdot 1 = 6\\ c &= 3^2 + 1^2 = 10. \end{align*} $$ Furthermore, $c = 2\cdot 5 \cdot 1$, so letting $m = 5$ and $n = 1$ gives $$ \begin{align*} d &= 5^2 - 1^2 = 24\\ e &= 5^2 + 1^2 = 26. \end{align*} $$ And again, $e = 2\cdot 13 \cdot 1$, so letting $m = 13$ and $n = 1$ gives $$\begin{align*} f &= 13^2 - 1^2 = 168\\ g &= 13^2 + 1^2 = 170. \end{align*}$$ Then $$\begin{align*} g^2 = 170^2 = 26^2 + 168^2 = 10^2 + 24^2 + 168^2 = 6^2 + 8^2 + 24^2 + 168^2 \end{align*} $$ Going one more step we can write $170 = 2\cdot 17 \cdot 5$ so $m = 17$ and $n = 5$ gives $$\begin{align*} h &= 17^2 - 5^2 = 264\\ i &= 17^2 + 5^2 = 314, \end{align*}$$ in which $314 = 2\cdot 157 \cdot 1$. It seems I may be on the right track, but I'm not sure if this is true in general. Maybe it can be proven that this process can be continued arbitrarily given we start with two distinct primes $m$ and $n$ in the first step? Any thoughts or references or anything would be wonderful. Thanks in advance!
Yes, your process can always be continued if you start with $m_1>n_1$ both odd. $$ a_1 = m_1^2-n_1^2 \equiv 0 \pmod{4} \\ b_1 = 2m_1n_1 \equiv 2 \pmod{4} \\ c_1 = m_1^2+n_1^2 \equiv 2 \pmod{4} $$ So $c_1/2$ is odd and we can factor it as $m_2\cdot n_2$ with $m_2>n_2$ both odd, take $m_2=c_1/2, n_2=1$ if necessary or any other factorization. Then for $k>1$ $$ a_k=m_k^2-n_k^2 \\ b_k = 2m_k n_k = c_{n-1} \\ c_k = m_k^2+n_k^2 \equiv 2 \pmod{4} $$ and $c_k/2$ is odd for every $k$ and we can repeat.