Gram Series


The Gram series is an approximation to the prime counting function given by


where zeta(z) is the Riemann zeta function (Hardy 1999, p. 24). This approximation is 10 times better than Li(x) for x<10^9 but has been proven to be worse infinitely often by Littlewood (Ingham 1990).


The Gram series is equivalent to the Riemann prime counting function (Hardy 1999, pp. 24-25)


where li(x) is the logarithmic integral and mu(n) is the Möbius function (Hardy 1999, pp. 16 and 23; Borwein et al. 2000), but is much more tractable for numeric computations. For example, the plots above show the difference G(x)-R(x) where R(x) is computed using the Wolfram Language's built-in NSum command (black) and approximated using the first 10^1 (blue), 10^2 (green), 10^3 (yellow), 10^4 (orange), and 10^5 (red) points.

A related series due to Ramanujan is


(Berndt 1994, p. 124; Hardy 1999, p. 23), where B_(2k) is a Bernoulli number. The integral analog, also found by Ramanujan, is


(Berndt 1994, p. 129; Hardy 1999, p. 23).

See also

Riemann Prime Counting Function

Explore with Wolfram|Alpha


Berndt, B. C. Ramanujan's Notebooks, Part IV. New York: Springer-Verlag, 1994.Borwein, J. M.; Bradley, D. M.; and Crandall, R. E. "Computational Strategies for the Riemann Zeta Function." J. Comput. Appl. Math. 121, 247-296, 2000.Gram, J. P. "Undersøgelser angaaende Maengden af Primtal under en given Graeense." K. Videnskab. Selsk. Skr. 2, 183-308, 1884.Hardy, G. H. Ramanujan: Twelve Lectures on Subjects Suggested by His Life and Work, 3rd ed. New York: Chelsea, 1999.Ingham, A. E. Ch. 5 in The Distribution of Prime Numbers. New York: Cambridge University Press, 1990.Ribenboim, P. The New Book of Prime Number Records. New York: Springer-Verlag, p. 225, 1996.Vardi, I. Computational Recreations in Mathematica. Reading, MA: Addison-Wesley, p. 74, 1991.

Referenced on Wolfram|Alpha

Gram Series

Cite this as:

Weisstein, Eric W. "Gram Series." From MathWorld--A Wolfram Web Resource.

Subject classifications