# Can every natural number be written as a sum of signed odd squares?

Let $$c_n \in \{ -1,1\}$$. Here, it is stated that every natural number may be written as

$$\sum c_kk^2$$

Where $$k$$ runs from $$1$$ to some finite number. I am wondering whether every natural number $$n$$ can be written as follows:

$$n = \sum c_n(2k-1)^2.$$

In other words,

can every natural number be written as the sum of the first so-and-so signed odd squares?

Obviously, $$1=1^2$$. However, even to find such a writing of $$2$$, I needed eight squares: $$2=1+9+25-49+81-121-169+225$$ And could not find one for $$3$$. Any insight would be appreciated.

• For any four consecutive odd squares $a^2-(a+2)^2-(a+4)^2+(a+6)^2=16$, so if we can make 1 to 16 inclusive then we're done. – nickgard Mar 17 '20 at 2:39
• If you can show that any $n \in [0, 8]$ can be written in that form, then any $n \in [-7, -1]$ can also be written (reverse the signs), and therefore any $n \in [-7, 8]$ can be expressed as desired. Then induction would follow: If $n$ can be expressed, then $$n + 16 = n +(2k+7)^2 - (2k+5)^2-(2k+3)^2 + (2k+1)^2$$ can be expressed as well. – Catalin Zara Mar 17 '20 at 2:39

How high do you have to go? $$1=+1^2$$ $$2=+1^2+3^2+5^2-7^2+9^2-11^2-13^2+15^2$$ $$3=+1^2+3^2+5^2+7^2-9^2$$ $$4=-1^2-3^2-5^2-7^2+9^2-11^2-13^2+15^2-17^2+19^2$$ $$5=+1^2+3^2+5^2+7^2-9^2+11^2+13^2+15^2+17^2-19^2-21^2$$ $$6=-1^2-3^2+5^2-7^2-9^2+11^2$$ $$7=+1^2+3^2+5^2+7^2+9^2+11^2+13^2+15^2+17^2-19^2+21^2-23^2-25^2-27^2+29^2$$ $$8=-1^2+3^2$$ $$9=-1^2-3^2+5^2-7^2-9^2-11^2-13^2-15^2-17^2+19^2-21^2-23^2-25^2-27^2+29^2+31^2+33^2$$ $$10=+1^2+3^2$$ $$11=-1^2-3^2+5^2-7^2-9^2-11^2-13^2-15^2+17^2-19^2-21^2+23^2+25^2$$ $$12=-1^2-3^2-5^2-7^2-9^2+11^2-13^2+15^2$$ $$13=-1^2-3^2-5^2-7^2+9^2+11^2-13^2-15^2+17^2$$ $$14=-1^2-3^2-5^2+7^2$$ $$15=-1^2-3^2+5^2$$ $$16=+1^2-3^2-5^2+7^2$$ $$17=+1^2-3^2+5^2$$ $$18=+1^2+3^2-5^2+7^2-9^2+11^2+13^2-15^2$$ $$19=+1^2+3^2+5^2-7^2+9^2+11^2-13^2$$ $$20=-1^2-3^2+5^2-7^2-9^2-11^2-13^2-15^2+17^2+19^2$$ $$21=+1^2+3^2+5^2+7^2+9^2+11^2+13^2-15^2-17^2-19^2+21^2$$ $$22=+1^2-3^2+5^2-7^2-9^2-11^2-13^2-15^2+17^2+19^2$$ $$23=+1^2+3^2+5^2+7^2+9^2+11^2+13^2-15^2+17^2+19^2-21^2+23^2+25^2-27^2-29^2$$ $$24=-1^2+3^2+5^2-7^2-9^2+11^2$$ $$25=-1^2-3^2-5^2-7^2-9^2-11^2+13^2+15^2-17^2-19^2-21^2-23^2-25^2-27^2+29^2+31^2+33^2$$ $$26=+1^2+3^2+5^2-7^2-9^2+11^2$$ $$27=-1^2-3^2-5^2-7^2-9^2-11^2+13^2-15^2+17^2-19^2+21^2$$ $$28=+1^2+3^2+5^2+7^2+9^2-11^2-13^2+15^2+17^2-19^2$$ $$29=+1^2-3^2-5^2-7^2-9^2-11^2+13^2-15^2+17^2-19^2+21^2$$ $$30=-1^2+3^2-5^2-7^2-9^2+11^2-13^2+15^2$$

• No higher. See the comments to the OP by myself and Catalin Zara. – nickgard Mar 17 '20 at 2:45
• @nickgard Cool. This program runs pretty much instantaneously. Do you guys have more fun challenges while it's in my view? – user5713492 Mar 17 '20 at 2:49

This is possible if $$c_k \in \{-1, 0, 1\}$$. For each $$m$$, consider that $$1 = (2m + 1)^2 + (m^2 + m - 1)^2 - (m^2 + m + 1)^2,$$ which is a sum/difference of odd squares. Note also that the minimal square, $$(2m + 1)^2$$, can be made as large as we want, hence we can make $$1$$ as many times as we want without reusing squares. Thus, to make any $$n$$, we simply need to make $$1$$ $$n$$ times, out of different odd squares, and sum the result.

(As a bonus, we can make each $$n$$ out of odd squares in this way infinitely many ways, as we can subtract $$1$$s as well as we like.)

• Would you be using all squares from 1 to $\max$? Note that $c_k \in \{ -1, 1\}$. – Catalin Zara Mar 17 '20 at 2:31
• I failed to notice that condition. I'll leave my answer here, given the partial results already posted. – user759562 Mar 17 '20 at 2:32

Shortest representations of small positive integers.

\begin{align*} 1 &= 1 \\ 2 &= 1 + 9 + 25 - 49 + 81 - 121 - 169 + 225 \\ 3 &= 1 + 9 + 25 + 49 - 81 \\ 4 &= -1-9-25-49+81-121-169+225-289+361 \\ 5 &= 1+9+25+49-81+121+169+225+289-361-441 \\ 6 &= -1-9+25-49-81+121 \\ 7 &= 1+9+25-49+81+121+169+225+289+361+441+529-625-729-841 \\ &= 1+9+25+49+81+121+169+225+289-361+441-529-625-729+841 \\ 8 &= -1+9 \\ 9 &= -1-9-25-49-81+121-169-225-289-361-441-529+625+729+841+961-1089 \\ &= -1-9+25-49-81-121-169-225-289+361-441-529-625-729+841+961+1089 \\ 10 &= 1 + 9 \\ 11 &= -1-9+25-49-81-121-169-225+289-361-441+529+625 \\ 12 &= -1-9-25-49-81+121-169+225 \\ 13 &= -1-9-25-49+81+121-169-225+289 \\ 14 &= -1-9-25+49 \\ 15 &= -1-9+25 \\ 16 &= 1-9-25+49 \\ 17 &= 1-9+25 \\ 18 &= 1+9-25+49-81+121+169-225 \\ 19 &= 1+9+25-49+81+121-169 \\ 20 &= -1-9+25-49-81-121-169-225+289+361 \\ 21 &= 1+9+25+49+81+121+169-225-289-361+441 \\ 22 &= -1-9+25-49-81+121+169-225-289+361 \\ &= -1+9-25-49+81-121-169+225-289+361 \\ &= 1-9+25-49-81-121-169-225+289+361 \\ 23 &= 1+9+25+49+81+121+169-225+289+361-441+529+625-729-841 \\ 24 &= -1-9+25+49+81-121 \\ &= -1+9+25-49-81+121 \\ 25 &= -1-9-25-49-81-121-169-225-289-361+441+529+625+729-841+961-1089 \\ &= -1-9-25-49-81-121-169+225-289-361-441+529-625+729+841+961-1089 \\ &= -1-9-25-49-81-121-169-225+289-361+441-529+625-729+841-961+1089 \\ &= 1-9-25-49-81-121-169-225-289-361-441-529+625+729+841-961+1089 \\ &= -1-9-25-49-81-121+169-225-289-361+441-529+625-729-841+961+1089 \\ &= -1-9-25-49+81-121-169-225-289-361-441+529+625-729-841+961+1089 \\ &= -1-9-25-49-81-121+169+225-289-361-441-529-625-729+841+961+1089 \\ 26 &= 1-9+25+49+81-121 \\ &= 1+9+25-49-81+121 \\ 27 &= -1-9-25-49-81-121+169-225+289-361+441 \\ 28 &= -1+9+25+49+81+121+169+225-289-361 \\ &= 1+9+25+49+81-121-169+225+289-361 \\ 29 &= -1-9-25-49+81-121+169-225+289+361-441 \\ &= -1-9+25-49-81-121-169+225+289+361-441 \\ &= -1-9-25+49-81+121-169-225+289-361-441 \\ &= 1-9-25-49-81-121+169-225+289-361+441 \\ 30 &= -1-9-25+49+81-121-169+225 \\ &= -1+9-25-49-81+121-169+225 \\ 31 &= -1-9+25+49-81-121+169 \\ 32 &= -1+9-25+49 \\ 33 &= -1+9+25 \\ 34 &= 1+9-25+49 \\ 35 &= 1+9+25 \\ 36 &= -1-9-25-49-81-121+169+225+289-361 \\ 37 &= -1+9+25+49+81+121+169=225-289+361+441-529-625 \\ &= 1+9+25+49+81-121-169+225+289+361+441-529-625 \\ &= 1+9+25+49+81+121-169+225-289-361+441+529-625 \\ 38 &= -1-9-25+49-81+121-169+225+289-361 \\ &= 1-9-25-49-81-121+169+225+289-361 \\ &= -1+9+25-49-81-121-169-225+289+361 \\ 39 &= 1+9+25+49+81+121+169+225-289+361+441-529-625 \\ 40 &= -1-9+25-49+81+121+169-225+289-361 \\ &= 1-9-25+49-81+121-169+225+289-361 \\ &= -1-9+25+49+81-121+169-225-289+361 \\ &= -1+9+25-49-81+121+169-225-289+361 \\ &= 1+9+25-49-81-121-169-225+289+361 \end{align*}

• Oops, you are right, I did indeed misunderstand the constraints. – orlp Mar 17 '20 at 18:33

$$\,\,\,\,\,\,\,\,\,\,\,$$ $$3=1+9+25+49-81$$