So I want to show a few things about the form $x^2+ y^2$, namely that for any number, $n$, we can find at least $n$ consecutive integers that are not the sum of two squares. So far, I've only shown that a number that is a sum of two squares has to be such that every prime occurring in the prime factorization that is $3 \text { mod } 4$ has an even exponent, but I'm not sure how to prove the last bit about the consecutive numbers. How should I continue?


The proof below is based on a paper${}^{\color{blue}{[1]}}$ by Ian Richards, I just fill in some gaps.

Given positive integer $n$,

  • Let $[n]$ be a short hand for $\{ 1, 2, \ldots, n \}$.
  • Let $\mathcal{P}$ be the subset of $[4n]$ consists of prime $\equiv -1 \pmod 4$.
  • For $p \in \mathcal{P}$, let $\beta(p)$ be the integer such that $p^{\beta(p)} \le 4n < p^{\beta(p)+1}$.
  • Let $P = \prod_{p \in \mathcal{P}} p^{\beta(p)+1}$ and pick a $y \in [P]$ such that $4y \equiv -1 \pmod P$.

For any $\ell \in [n]$, we claim $y + \ell$ isn't a sum of squares.

Assume the contrary, let's say $y + \ell = u^2+v^2$ for some integers $u,v$. We have

$$4(u^2+v^2) = 4(y+\ell) \equiv 4\ell - 1\pmod P$$

Since $4\ell-1 \equiv -1\pmod 4$, $4 \ell - 1$ contains prime factors from $\mathcal{P}$ whose exponent is odd. Let $p$ be one of these prime with exponent $2a+1$, i.e. $p \in \mathcal{P}$ which satisfies

$$p^{2a+1} | 4\ell - 1 \quad\text{ but }\quad p^{2a+2} \not| 4\ell - 1$$

By Chinese remainder theorem, $$4(u^2+v^2) \equiv 4\ell - 1 \pmod P \quad\implies\quad 4(u^2 + v^2) \equiv 4\ell - 1 \pmod {p^{\beta(p)+1}}\tag{*1} $$ Since $2a+1 \le \beta(p)+1$, this leads to $p^{2a+1} | 4(u^2+v^2)$.

Since prime of the form $\equiv -1 \pmod 4$ is prime in the ring of Gaussian integers, $$p^{2a+1} | 4(u^2+v^2)\quad\implies\quad p^{2a+2} | 4(u^2+v^2)$$

Since $2a+2 \le \beta(p)+1$, RHS of $(*1)$ tell us $p^{2a+2} | 4\ell - 1$. This contradicts with the role of $p$ and $a$.

As a result, none of the $n$ consecutive integers $y+1, y+2, \ldots, y + n$ is a sum of two squares. This means the gap between the sum of two squares can be as large as one wish.


  • $\color{blue}{[1]}$ I Richards, On the gaps between numbers which are sums of two squares - Advances in Mathematics, 1982 - Academic Press (an online copy can be found here)

You have indicated that, given a prime $q \equiv 3 \pmod 4,$ if a positive number $n$ is divisible by $q$ but not by $q^2$ then it cannot be the sum of two squares.

Let $m+1 \equiv 3 \pmod 9.$ Then let $m+2 \equiv 7 \pmod {49}.$ Next $m+3 \equiv 11 \pmod {121}.$ Keep going, up to $m+n \equiv q_n \pmod {q_n^2}$

This is possible by repeated Chinese Remainder Theorem.

  • $\begingroup$ I understand most of this proof, but how do you know that m+2 is 7 mod 49, for example? Doesn't the Chinese remainder theorem only guarantee unique existence? $\endgroup$ – Sultan of Quizikhstan Oct 24 '18 at 3:00
  • 1
    $\begingroup$ @SultanofQuizikhstan force $m \equiv 2 \pmod 9,$ then $m \equiv 5 \pmod {49},$ then $m \equiv 8 \pmod{121}$ $\endgroup$ – Will Jagy Oct 24 '18 at 3:08
  • $\begingroup$ To the proposer: The Chinese Remainder Theorem implies that there exists $m$ that satisfies all $n$ of the congruences. $\endgroup$ – DanielWainfleet Oct 24 '18 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.