# Three consecutive sums of two squares

$0, 1, 2$ is an example of three consecutive non-negative integers $n, n+1, n+2$ which are each the sum of two integer squares. Using modular arithmetic you can prove that in all of these triplets $n \equiv 0 \pmod 8$ .

Now I'm wondering, is there a way to find all such triplets? Below are two ways I've found which generate infinite triplets, but not all:

Because $(a^2 + b^2)(c^2 + d^2) = (ac - bd)^2 + (ad + bc)^2$, you can take any triplet (except $0, 1, 2$ which will give itself) and generate a new triplet. If $n, n+1, n+2$ is the chosen triplet then the following is also a triplet:

$$n(n+2) = n^2 + 2n$$

$$(n+1)^2 + 0^2 = n^2 + 2n + 1$$

$$(n+1)^2 + 1^2 = n^2 + 2n + 2$$

Assume that there exists a triplet in the following form (letting $b^2 = 2a^2 + 1$):

$$a^2 + a^2 = 2a^2$$

$$2a^2 + 1 = b^2 + 0^2$$

$$2a^2 + 2 = b^2 + 1$$

Solving $b^2 = 2a^2 + 1$ using the convergents for $\sqrt 2$ you'll find that every second convergent ($3/2$, $17/12$, $99/70$, etc.) will be in the form $b/a$.

For example:

$$70^2 + 70^2 = 9800$$

$$99^2 + 0^2 = 9801$$

$$99^2 + 1^2 = 9802$$

-
The sequence of numbers n such that n, n+1, n+2 are all sums of two squares is given at oeis.org/A082982 . (As you'd expect, they're all multiples of 8.) This sequence doesn't look to me like there's a nice formula. Of course this doesn't prove there isn't one. – Michael Lugo Jun 20 '11 at 15:07

The numbers $4n^4+4n^2,4n^4+4n^2+1,4n^4+4n^2+2$ are all sums of two squares, so there's another infinite family. I don't think you're going to find a useful formula that will give all solutions, but I don't see how to prove this.