Some numbers can be expressed as the sum of two squares (ex. $10=3^2+1^2$) such as: $$0,1,2,4,5,8,9,10,13,16,17,18,20,25,...$$ Other numbers are not the sum of any two squares of integers: $$3,6,7,11,12,14,15,19,21,22,23,24,27,...$$ There are a lot of examples of $3$ consecutive numbers that are each the sum of 3 squares. The first is $$0=0^2+0^2\quad\quad1=1^2+0^2 \quad\quad 2=1^2+1^2$$ The largest example I've found is $$99952=444^2+896^2\quad 99953=568^2+823^2\quad 99954=327^2+945^2$$ This question seems to be related to the prime decomposition of consecutive numbers. It's pretty easy to use Fermat's theorem on sums of two squares and divisibility by $3$ to show that there can't be $6$ consecutive numbers of this type. But I can't manage to prove anything about $4$ or $5$ such consecutive numbers.

There were no examples of $4$ consecutive numbers of this type less than $100000$. Are there any?

  • 4
    $\begingroup$ One of them would have to be $\equiv3\pmod4$. $\endgroup$ Aug 8, 2017 at 18:41
  • $\begingroup$ By the way, you can always find a larger example of $3$ consecutive sums of $2$ squares. Note that the set of integers that are sums of two squares is closed under multiplication, so if $n-1,n,n+1$ are each sums of two squares, then so are $n^2-1,n^2,n^2+1$, the first one because $n^2-1=(n-1)(n+1)$, and the other two are $n^2+0^2$ and $n^2+1^2$. $\endgroup$ May 20, 2020 at 18:13

2 Answers 2


There are not. A square always has a residue of 0 or 1 mod 4, so the sum of two squares has a residue of 0, 1, or 2.

But among any four consecutive numbers, one has a residue of 3 and so cannot be a sum of two squares.


No, there aren't

Every odd integer that is the sum of two squares, is congruent to $1$ modulo $4$ because every prime factor of the form $4k+3$ must occur in a power with even exponent.


Your Answer

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