Project Euler

Problem #229

Consider the number 3600. It is very special, because

3600 = 48^(2) +     36^(2)

3600 = 20^(2) + 2×40^(2)

3600 = 30^(2) + 3×30^(2)

3600 = 45^(2) + 7×15^(2)

Similarly, we find that 88201 = 99^(2) + 280^(2) = 287^(2) + 2×54^(2) = 283^(2) + 3×52^(2) = 197^(2) + 7×84^(2).

In 1747, Euler proved which numbers are representable as a sum of two squares. We are interested in the numbers n which admit representations of all of the following four types:

n = a_(1)^(2) +   b_(1)^(2)

n = a_(2)^(2) + 2 b_(2)^(2)

n = a_(3)^(2) + 3 b_(3)^(2)

n = a_(7)^(2) + 7 b_(7)^(2),

where the a_(k) and b_(k) are positive integers.

There are 75373 such numbers that do not exceed 10^(7).
How many such numbers are there that do not exceed 2×10^(9)?