# Classification of the positive integers not being the sum of four non-zero squares

It is well known that every positive integer is the sum of at most four perfect squares (including $1$).

But which positive integers are not the sum of four non-zero perfect squares ($1$ is still allowed as a perfect square) ?

I showed that the numbers $2^k$ , $2^k\cdot 3$ and $2^k\cdot 7$ with odd positive integer $k$ have this property. I checked the numbers upto $10^4$ and above $41$, no examples , other than those of the mentioned forms , occured. So my question is whether additional positive integers with the desired property exist.

• Another formulation of the question : If $n>41$ is an integer and $n=a^2+b^2+c^2+d^2$ has no solution in positive integers, must $n$ be of the form $2^k$ or $2^k\cdot 3$ or $2^k\cdot 7$ with odd positive integer $k$ ? – Peter Jun 9 '18 at 13:51

## 2 Answers

page 140 in Conway's little book, $$1,3,5,9,11,17,29,41, \; 2 \cdot 4^m \; , \; 6 \cdot 4^m \; , \; 14 \cdot 4^m \; .$$ The proof is on the same page, with preparatory material in the previous few pages.

The first detail: any number $3 \pmod 8$ is the sum of three squares, meanwhile they must be odd squares, therefore nonzero. The square of any number that is divisible by $4$ becomes $0 \pmod 8.$ As a result, any number $6 \pmod 8$ is the sum of three squares, as $(2A)^2 + B^2 + C^2,$ where $A,B,C$ must be odd squares, therefore nonzero.

10 June: Second detail: if $x^2 + y^2 + z^2 \equiv 0 \pmod 4,$ then $x,y,z$ are all even. This means that $12 \pmod{32}$ is the sum of three nonzero squares. Same for $24 \pmod{32}$

• @JamesArathoon I transcribed incorrectly. I put in a link for a pdf, you can check page 140 yourself. Believe I have it now. – Will Jagy Jun 9 '18 at 18:17
• Thanks for correcting transcription. All the primes listed are the sum of 2 or 3 non-zero squares. In the case of the largest 3 primes above, 17, 29, and 41 they are the sum of both 2 and 3 non-zero squares. The proof shows that any prime larger than 41 must be the sum of 4 non-zero squares, even if that prime is the sum of both 2 and 3 non-zero squares. – James Arathoon Jun 9 '18 at 18:34
• Thank you. So every other number can be expressed as the sum of four non-zero squares. – Peter Jun 9 '18 at 20:07
• @Peter yes. I put a link to a pdf of Conway's book. You would like the first chapter, he defines the Topograph method, which becomes especially useful when trying to find all solutions $(x,y)$ to $A x^2 + B xy + C y^2 = N.$ Recently you were asking about finding all solutions to $x^2 - k y^2 = n,$ the topograph is the responsible way to do that. – Will Jagy Jun 9 '18 at 20:14
• @WillJagy Sorry, I looked at page $140$ , but I didn't find where the key for the proof is. Please help! – Peter Jun 9 '18 at 20:38
• Excellent! will help me a lot! – Mike SQ Jun 11 '18 at 22:58