When can we represent n as a sum of squares with square roots that lie in an arithmetic progression.

72 Views Asked by At

I was thinking about the Fermat Polygonal Number Theorem, which says that every positive integer $n$ can be written as a sum of $r$ $r$-gonal numbers (including zero). For example $29 = 0+1+28 = 0+0+4+25$.

Although I don't know the details of the general proof, I know that in the case of $r=3$, this can be proved by noticing that $n$ is expressible as a sum of $3$ triangular numbers if and only if $8n+3$ is expressible as a sum of three odd squares. In other words, we're proving that for all $n \equiv 3 \pmod 8$, $n = a^2 + b^2 + c^2$ with $a \equiv b \equiv c \equiv 1 \pmod 2$.

Of course since that's the only way that $8n+3$ can be expressed as a sum of three squares, this reduces to a special case of the sum of three squares theorem.

We can do similar things with higher cases, for example if I've done the calculations correctly, the claim that every integer is expressible as a sum of $5$ pentagonal numbers is equivalent to saying that every integer $24n + 5$ is expressible as a sum of $5$ squares with their square-roots congruent to $-1 \pmod 6$.

The truth of Fermat's theorem implies that this is the case, but it raised the question about more general cases - in particular which $n$ can be written as a sum of squares of elements from a particular arithemtic progression. I messed about a bit with the generating function $f(x) = 1 + 2 \sum_{i=1}^{\infty} x^{i^2}$ and using roots of unity to extract the terms in arithmetic progressions, but I wasn't able to make any progress this way.

So my question is: When can $n$ be written as a sum of squares with square roots in a particular arithmetic progression? (i.e. all congruent to a fixed $r$ modulo a fixed $m$)