Let
denote the number of positive integers not exceeding
which can be expressed as a sum of two squares (i.e., those
such that the sum
of squares function
). For example, the first few positive integers that
can be expressed as a sum of squares are
(1)
| |||
(2)
| |||
(3)
| |||
(4)
| |||
(5)
|
(OEIS A001481), so ,
,
,
,
, and so on. Then
(6)
|
as proved by Landau (1908), where is a constant. Ramanujan independently stated the theorem
in the slightly different form that the number of numbers between
and
which are either squares of sums of two squares is
(7)
|
where
and
is very small compared with the previous integral (Berndt and Rankin 1995, p. 24;
Hardy 1999, p. 8; Moree and Cazaran 1999).
Note that for ,
iff
is not divisible by a prime power
with
and
odd.
The constant has numerical value
(8)
|
(OEIS A064533). However, the convergence to the constant ,
known as the Landau-Ramanujan constant and sometimes also denoted
, is very slow. The following table summarizes the values
of the left side of equation (7) for the first few powers of
10, where the sequence of
is (OEIS A164775).
7 | 1.062199 | |
43 | 0.922765 | |
330 | 0.867326 | |
2749 | 0.834281 | |
24028 | 0.815287 | |
216341 | 0.804123 | |
1985459 | 0.797109 | |
18457847 | 0.792198 | |
173229058 | 0.788587 | |
1637624156 | 0.785818 |
An exact formula for the constant is given by
(9)
|
(Landau 1908; Le Lionnais 1983, p. 31; Berndt 1994; Hardy 1999; Moree and Cazaran 1999), and an equivalent formula is given by
(10)
|
Flajolet and Vardi (1996) give a beautiful formula with fast convergence
(11)
|
where
is the Dirichlet beta function.
Another closed form is
(12)
|
where
is the Kronecker delta and
is the sum of squares
Function.
W. Gosper used the related formula
(13)
|
where
(14)
|
where
is a Bernoulli number and
is a polygamma function
(Finch 2003).
Landau also proved the even stronger fact
(15)
|
where
(16)
| |||
(17)
|
(OEIS A085990), e is the base of the natural logarithm, is the Euler-Mascheroni
constant, and
is the lemniscate constant.
Landau's method of proof can be extended to show that
(18)
|
has an asymptotic series
(19)
|
where
can be arbitrarily large and the
are constants with
(Moree and Cazaran 1999).