# How are natural numbers that cannot be written as a sum of exactly four squares of naturals characterized? [closed]

This is most probably asked here already in some other form (as it seems to be a very basic question) but since I have't found some question very similar to this one I feel obliged to ask (also because I do not know how to answer it at present and because this question appears in some of elementary researches I do).

Lagrange's four-square theorem guarantees that for every $$m \in \mathbb N_0=\{0,1,2,...\}$$ there is at least one quadruple of integers $$(a_1(m),a_2(m),a_3(m),a_4(m))$$ such that $$m=\displaystyle\sum_{i=1}^{4}(a_i(m))^2$$.

But, if the statement is slightly changed so to only allow quadruples that are subsets of $$\mathbb N^4$$ (instead of $$\mathbb Z^4$$ (or, equivalently, $$\mathbb {N}_0^4$$) then the statement is no longer true.

In other words, not every natural number is a sum of exactly four squares of naturals.

So, the set of all natural numbers (that is, elements of $$\mathbb N=\{1,2,3,\dotsc\}$$) that can be written as the sum of exactly four squares of natural numbers is not equal to all of $$\mathbb N$$.

If that exceptional set (the set of all natural numbers that cannot be represented as the sum of exactly four squares of naturals) is denoted as $$E_4$$, I have a basic question:

• How to characterize elements of $$E_4$$?

For example, is there a statement of the form "$$w \in E_4$$ if and only if $$w$$ is (or is not) of the form $$a^k(bl+c)$$", for some special choice (or choices) of $$a$$, $$b$$, $$c$$?

Or there is some other characterization?

Edit: If I did not misinterpret something, it seems that we have an answer here, so the question can be appropriately closed.

• I'm voting to close this question as off-topic because it was already answered on math.stackexchange. – Jeremy Rouse Apr 1 at 20:34
• @JeremyRouse that seems appropriate, i have linked the MSE question, and the answer is there – user153451 Apr 1 at 20:35
• If that´s better, I can also delete this question, upon request. – user153451 Apr 1 at 20:37
• Sorry, I did not see Jeremy Rouse's remark. So I answered the question below. – GH from MO Apr 1 at 20:38
• @GHfromMO That´s not a problem, it is good to have an answer, no matter the destiny of the question. I won´t delete it. – user153451 Apr 1 at 20:38

This problem was solved by Dubois (1911). The exceptional integers are: $$1$$, $$3$$, $$5$$, $$8$$, $$9$$, $$11$$, $$17$$, $$29$$, $$41$$, $$2\cdot 4^m$$, $$6\cdot 4^m$$, $$14\cdot 4^m$$. This is quoted in this 2016 paper by Byeong Moon Kim.
I have not seen the original proof, but here is a sketch how I would prove it. First I would solve the problem for odd integers. An odd integer $$n$$ has at least $$8(n+1)$$ representations as a sum of four squares, but only $$O(n^{1/2+\epsilon})$$ representations as a sum of three squares (the implied constant depends effectively on $$\epsilon>0$$). Hence every sufficiently large odd integer is a sum of four positive squares.
• @Ante: $29=5^2+2^2=4^2+3^2+2^2$. Also, $1$ cannot be written as a sum of two or three positive squares. – GH from MO Apr 1 at 20:50