Let $N=4^KL$ where $L\equiv\ 7\pmod 8$. Prove that $N$ cannot be written as a sum of 3 squares
Problem
Source: Nigerian senior mathematics Olympiad round 2 problem 6.
Tags: number theory
08.09.2019 18:54
This is very old and well-known: Suppose that $N=a^2+b^2+c^2$ and that $K \ge 1$. By considering modulo $4$, all of $a,b,c$ must be even so we can divide everything by $4$. We can repeat this argument as long as $K \ge 1$. So it suffices to treat the case $K=0$. But again by considering modulo $8$, we cannot write a number $L \equiv 7 \mod 8$ as a sum of three squares. Done.
08.09.2019 20:52
In[2]:=Flatten[Table[Mod[a^2+b^2+c^2,8],{a,1,8},{b,1,8},{c,1,8}]]//Union Out[2]= {0,1,2,3,4,5,6} This can also be verified by enumeration of all combo regardless of duplication. For a, b and c that form complete residue family of $mod{(8)}$, 7 is not in the final list. Proved. Or you can use quadratic residue directly in the attachment.
Attachments:

09.09.2019 10:10
In fact, N cannot be written as a sum of 3 squares if and only if $N=4^K L$ where $L \equiv 7$ mod 8. The other direction is harder to prove though.