<s>[INST] Square equal to sum of three squares For which integers $n$ there exists integers $0\le a,b,c < n$ such that $n^2=a^2+b^2+c^2$?
I made the following observations:

*

*For $n=1$ and $n=0$ those integers doesn't exist.


*If $n$ is a power of 2 those integers doesn't exist. Let $n=2^m$ with $m>0$ the smallest power of 2 for which there exists $a,b,c$ such that $\left (2^m\right )^2=4^m=a^2+b^2+c^2$. Since $4^m$ is divisible by 4, $a^2+b^2+c^2$ has to be divisible by 4 too. This is only possible if $a^2\equiv b^2\equiv c^2\equiv 0\pmod 4$, so we can write $a=2a',b=2b',c=2c'$ with $a',b',c'\in \mathbb{N}$. But then we get $\left (2^{m-1}\right )^2=4^{m-1}=a'^2+b'^2+c'^2$, so $m=1$, otherwise $2^m$ wouldn't be the smallest power of two with this property. It is easy to check that $n=2$ doesn't work, so for $n=2^m$ the statement doesn't hold.


*I suspect (but can't prove) that for all other values the statement holds. It would be enough to prove that for all odd primes $p$ there exists $a,b,c$ such that $p^2=a^2+b^2+c^2$, since for all other values of $n$ there exist some $p,m$ such that $n=pm$. Then we get $n^2=(pm)^2=(ma)^2+(mb)^2+(mc)^2$.
 [/INST] Some Pythagorean triples:
$3^2+4^2=5^2$
$5^2+12^2=13^2$
So: $3^2+4^2+12^2=13^2$
Generalize that:
$(3t)^2+(4t)^2+(12t)^2=(13t)^2$
$n=13t$  , $t> 0 $
</s>