Integer as Sums and Differences of Consecutive Squares

Theorem
Every integer $k$ can be represented in infinitely many ways in the form:
 * $k = \pm 1^2 \pm 2^2 \pm 3^3 \pm \dots \pm m^2$

for some (strictly) positive integer $m$ and some choice of signs $+$ or $-$.

Proof
First we notice that:

Now we prove a weaker form of the theorem by induction:


 * Every positive integer $k$ can be represented in at least one way in the form:
 * $k = \pm 1^2 \pm 2^2 \pm 3^3 \pm \dots \pm m^2$
 * for some (strictly) positive integer $m$ and some choice of signs $+$ or $-$.

Basis for the Induction
From the identity above we have:

Also we have, more or less trivially:
 * $1 = + 1^2$
 * $2 = - 1^2 - 2^2 - 3^2 + 4^2$
 * $3 = - 1^2 + 2^2$

This is the basis for the induction.

Induction Hypothesis
This is the induction hypothesis:
 * For some positive integer $k$, we have:
 * $k = \pm 1^2 \pm 2^2 \pm 3^3 \pm \dots \pm m^2$
 * for some (strictly) positive integer $m$ and some choice of signs $+$ or $-$.

Now we need to show true for $n = k + 4$:
 * $k + 4 = \pm 1^2 \pm 2^2 \pm 3^3 \pm \dots \pm {m_2}^2$
 * for some (strictly) positive integer $m_2$ and some choice of signs $+$ or $-$.

Induction Step
This is the induction step:

which is of the required form.

Hence every positive integer $k$ can be represented in at least one way in the required form.

From the identity above we can also conclude:

therefore if $k$ can be written as:
 * $k = \pm 1^2 \pm 2^2 \pm 3^3 \pm \dots \pm m^2$

it can also be written as:
 * $k = \pm 1^2 \pm 2^2 \pm 3^3 \pm \dots \pm m^2 + \paren {m + 1}^2 - \paren {m + 2}^2 - \paren {m + 3}^2 + \paren {m + 4}^2 - \paren {m + 5}^2 + \paren {m + 6}^2 + \paren {m + 7}^2 - \paren {m + 8}^2$

and:
 * $k = \pm 1^2 \pm 2^2 \pm 3^3 \pm \dots \pm \paren {m + 8}^2 + \paren {m + 9}^2 - \paren {m + 10}^2 - \paren {m + 11}^2 + \paren {m + 12}^2 - \paren {m + 13}^2 + \paren {m + 14}^2 + \paren {m + 15}^2 - \paren {m + 16}^2$

and so on.

Hence every positive integer $k$ can be represented in infinitely many ways in the required form.

Finally we cover the case where $k$ is a negative integer.

Since $-k$ is a positive integer, it can be represented in infinitely many ways in the required form.

For every representation of $-k$ in this way, by flipping every $+$ and $-$ sign, we end up with a representation of $- \paren {- k} = k$.

Hence every integer $k$, positive or negative, can be represented in infinitely many ways in the required form.

Example
Since the proof above is constructive, we can follow the proof and derive:

and its associated family of solutions:

and so on.

However this may not give the least number of squares that this works for.

In fact we have:

from Triangular Number as Alternating Sum and Difference of Squares.

Historical Note
attributes this result to and an M. Suranyi.