# sum of 3 squares [duplicate]

I want to show that any integer of the form $n=4^m(8k+7)$ with $m,k\ge0$ cannot be expressed as a sum of 3 squares.

The case for $m=0$ is easy to prove since the sum of 3 squares cannot be $\equiv7\bmod8$.

However, I am very confused with the proof for the general case, because

• if $m=1$ then $n\equiv4\bmod8\not\equiv7\bmod8$, so can be expressed as a sum of 3 squares
• if $m>1$, $8\mid n$, so is also a sum of 3 squares

I might be overlooking something here, can anyone shed some light?

## marked as duplicate by Dietrich Burde, Nosrati, GNUSupporter 8964民主女神 地下教會, Shailesh, NamasteDec 11 '17 at 0:29

• Please use MathJax to format your text - it will make your question look neater and more readable. – Toby Mak Dec 10 '17 at 5:08
• Yes, I will, thank you! – Yuumi Dec 10 '17 at 5:14
• The proof is actually quite complicated. What this theorem actually says is that while all numbers in the form $8k+7$ (Parcly Taxel made a typo) cannot be the sum of three squares, there are other numbers, like $4$ and $16$ that also cannot, which are all represented in the form $4^m(8k+1)$. – Toby Mak Dec 10 '17 at 5:28
• This is one proof I could find, if you want to read it. – Toby Mak Dec 10 '17 at 5:30
• If a multiple of 4 is a sum of three squares, each square must be even, hence a multiple of 4, so divide through by 4, and iterate. – Gerry Myerson Dec 10 '17 at 6:29

In regard to proving numbers of the form $(8k+7)$ can't be the sum of three squares is not the following simple proof satisfactory

Calculate the square of $(8k)$ through to $(8k+7)$. The number squared is in the form $(8k+n)$ where $n$ is an integer number from $0$ to $7$.

The result is $(8k+n)^2 \equiv 0,1,4 \pmod{8}$.

That is the numbers can only be in the form $(8m)$, $(8m+1)$, $(8m+4)$.

Now all we need do is add up all combinations of these three numbers as sets of three, thus if $r+s+t=v$

$$(8r)+(8s)+(8t)=(8v)$$ $$(8r+1)+(8s)+(8t)=(8v+1)$$ $$(8r+1)+(8s+1)+(8t)=(8v+2)$$ $$(8r+1)+(8s+1)+(8t+1)=(8v+3)$$ $$(8r+4)+(8s)+(8t)=(8v+4)$$ $$(8r+4)+(8s+1)+(8t)=(8v+5)$$ $$(8r+4)+(8s+1)+(8t+1)=(8v+6)$$ $$(8r+4)+(8s+4)+(8t)=(8(v+1))$$ $$(8r+4)+(8s+4)+(8t+1)=(8(v+1)+1)$$ $$(8r+4)+(8s+4)+(8t+4)=(8(v+1)+4)$$

Thus we find that no combination adds up to a number of the form $(8k+7)$

There are other numbers not of the form $(8k+7)$ that are not the sum of three non-zero squares, for example $1$, $2$, $5$, $10$, $13$, $25$, $37$, $58$, $85$ and $130$. I am not sure if this is the complete list as yet.

Second Part If the above are defined as the primitives we need also need to find the complete list of multipliers that can be used to generate further numbers that are not the sum of three non-zero squares. This boils down to showing why $4^m$ is the only such multiplier.

A first step is to prove the proposition: (not proved as yet) If a number that not the sum of $3$ squares, is multiplied by $4$ raised to an arbitrary power, then the product of the two numbers also cannot be expressed as the sum of three non-zero squares.

Note that $4^m$ cannot be written as a sum of two non-zero squares or a sum of three non-zero squares, but only as a minimum of four non-zero squares, that is

$$4^m=2^{2m}=2^{2(m-1)}+2^{2(m-1)}+2^{2(m-1)}+2^{2(m-1)}$$

If a positive integer $r=a^2+b^2+c^2$ is multiplied by $4^m$ then the new integer $u=4^mr$ still remains the sum of three squares. Since

$$u=4^m(a^2+b^2+c^2)=((2^ma)^2+(2^mb)^2+(2^mc)^2)$$

If a number is not a sum of 3 [non-zero] squares then it can always be expressed as the sum of four squares Lagrange's four-square theorem (or if you want you could refer a larger number of squares greater than 4). Therefore if s is a number that cannot be written as the sum of 3 [non-zero] squares then in the same way as before it can be written as a new sum of four squares or any number of squares $>4$ and $\le s$.

$$v=4^ms=4^m(a^2+b^2+c^2+d^2)=((2^ma)^2+(2^mb)^2+(2^mc)^2+(2^md)^2)$$

*****This Conclusion is premature I think - Start****

If converting the new number into a sum of three squares were possible, then dividing out the $4^m$ factor would reveal a contradiction.

*****End****

If the numbers $(8k+7)$, $1$, $2$, $5$, $10$, $13$, $25$, $37$, $58$, $85$ and $130$ are all the primitives that that cannot be written as the sum of $3$ squares, then the full list of numbers that cannot be written as the sum of three squares is $(8k+7)\times4^m$, $1\times4^m$, $2\times4^m$, $5\times4^m$, $10\times4^m$, $13\times4^m$, $25\times4^m$, $37\times4^m$, $58\times4^m$, $85\times4^m$ and $130\times4^m$

It would be nice to be to be able to prove whether or not this is the full list.

• Finally got it right. Described as the long and tedious way in math.stackexchange.com/questions/779784/… – James Arathoon Dec 10 '17 at 13:43
• That is very smart, thanks! :) – Yuumi Dec 11 '17 at 6:50
• After sleeping on it I don't think the second part proof works yet and I have not proved why other squares such as $5^2$ cannot be used as a multiplier. $5^2$ can be written as the sum of two non-zero squares, but it can't be written as the sum of three non-zero squares. I think all squares, other than $1^2$, $2^2$, $4^2$ and $5^2$, can be written as the sum of three non-zero squares, but I do not have a proof of this other than observing that a square is never of the form (8k+7). – James Arathoon Dec 11 '17 at 15:21
• The question doesn't ask about sums of three nonzero squares, just about sums of three squares, so why are you banging on about nonzero squares? – Gerry Myerson Dec 12 '17 at 10:27
• But since you are interested in sums of nonzero squares, see oeis.org/A051952 – Gerry Myerson Dec 12 '17 at 10:35