Riemann Prime Counting Function


Riemann defined the function f(x) by

f(x)=sum_(p^(nu)<=x; p prime)1/nu

(Hardy 1999, p. 30; Borwein et al. 2000; Havil 2003, pp. 189-191 and 196-197; Derbyshire 2004, p. 299), sometimes denoted pi^*(x), J(x) (Edwards 2001, pp. 22 and 33; Derbyshire 2004, p. 298), or Pi(x) (Havil 2003, p. 189). Note that this is not an infinite series since the terms become zero starting at n=|_lgx_|, and where |_x_| is the floor function and lgx is the base-2 logarithm. For x=1, 2, ..., the first few values are 0, 1, 2, 5/2, 7/2, 7/2, 9/2, 29/6, 16/3, 16/3, ... (OEIS A096624 and A096625). As can be seen, when x is a prime, f(x) jumps by 1; when it is the square of a prime, it jumps by 1/2; when it is a cube of a prime, it jumps by 1/3; and so on (Derbyshire 2004, pp. 300-301), as illustrated above.

Amazingly, the prime counting function pi(x) is related to f(x) by the Möbius transform


where mu(n) is the Möbius function (Riesel 1994, p. 49; Havil 2003, p. 196; Derbyshire 2004, p. 302). More amazingly still, f(x) is connected with the Riemann zeta function zeta(s) by


(Riesel 1994, p. 47; Edwards 2001, p. 23; Derbyshire 2004, p. 309). f(x) is also given by


where zeta(z) is the Riemann zeta function, and (5) and (6) form a Mellin transform pair.


Riemann (1859) proposed that


where li(x) is the logarithmic integral and the sum is over all nontrivial zeros rho of the Riemann zeta function zeta(z) (Mathews 1961, Ch. 10; Landau 1974, Ch. 19; Ingham 1990, Ch. 4; Hardy 1999, p. 40; Borwein et al. 2000; Edwards 2001, pp. 33-34; Havil 2003, p. 196; Derbyshire 2004, p. 328). Actually, since the sum of roots is only conditionally convergent, it must be summed in order of increasing I[rho] even when pairing terms rho with their "twins" 1-rho, so


(Edwards 2001, pp. 30 and 33).

This formula was subsequently proved by Mangoldt (1895; Riesel 1994, p. 47; Edwards 2001, pp. 48 and 62-65). The integral on the right-hand side converges only for x>1, but since there are no primes less than 2, the only values of interest are for x>=2. Since it is monotonic decreasing, the maximum therefore occurs at x=2, which has value


(OEIS A096623; Derbyshire 2004, p. 329).


Riemann also considered the function


sometimes also denoted Ri(x) (Borwein et al. 2000), obtained by replacing f(x^(1/n)) in the Riemann function with the logarithmic integral li(x^(1/n)), where zeta(z) is the Riemann zeta function and mu(n) is the Möbius function (Hardy 1999, pp. 16 and 23; Borwein et al. 2000; Havil 2003, p. 198). R(x) is plotted above, including on a semilogarithmic scale (bottom two plots), which illustrate the fact that R(x) has a series of zeros near the origin. These occur at 10^(-x) for x=14827.7 (OEIS A143530), 15300.7, 21381.5, 25461.7, 32711.9, 40219.6, 50689.8, 62979.8, 78890.2, 98357.8, ..., corresponding to x=1.829×10^(-14828) (OEIS A143531), 2.040×10^(-15301), 3.289×10^(-21382), 2.001×10^(-25462), 1.374×10^(-32712), 2.378×10^(-40220), 1.420×10^(-50690), 1.619×10^(-62980), 6.835×10^(-78891), 1.588×10^(-98358), ....


The quantity R(x)-pi(x) is plotted above.

This function is implemented in the Wolfram Language as RiemannR[x].

Ramanujan independently derived the formula for R(n), but nonrigorously (Berndt 1994, p. 123; Hardy 1999, p. 23). The following table compares pi(10^n) and R(10^n) for small n. Riemann conjectured that R(n)=pi(n) (Knuth 1998, p. 382), but this was disproved by Littlewood in 1914 (Hardy and Littlewood 1918).


The Riemann prime counting function is identical to the Gram series


where zeta(z) is the Riemann zeta function (Hardy 1999, pp. 24-25), but the Gram series 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.

In the table, [x] denotes the nearest integer function. Note that the values given by Hardy (1999, p. 26) for x=10^9 are incorrect.


Riemann's function is related to the prime counting function by


where the sum is over all complex (nontrivial) zeros rho of zeta(s) (Ribenboim 1996), i.e., those in the critical strip so 0<R[rho]<1, interpreted to mean


However, no proof of the equality of (12) appears to exist in the literature (Borwein et al. 2000).

See also

Gram Series, Prime Counting Function, Prime Number Theorem, Riemann Function, Riemann Hypothesis, Soldner's Constant

Explore with Wolfram|Alpha


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.Berndt, B. C. Ramanujan's Notebooks, Part IV. New York: Springer-Verlag, 1994.Derbyshire, J. Prime Obsession: Bernhard Riemann and the Greatest Unsolved Problem in Mathematics. New York: Penguin, 2004.Edwards, H. M. Riemann's Zeta Function. New York: Dover, 2001.Hardy, G. H. and Littlewood, J. E. Acta Math. 41, 119-196, 1918.Hardy, G. H. "The Series R(x)." §2.3 in Ramanujan: Twelve Lectures on Subjects Suggested by His Life and Work, 3rd ed. New York: Chelsea, 1999.Havil, J. Gamma: Exploring Euler's Constant. Princeton, NJ: Princeton University Press, p. 42, 2003.Ingham, A. E. The Distribution of Prime Numbers. London: Cambridge University Press, p. 83, 1990.Knuth, D. E. The Art of Computer Programming, Vol. 2: Seminumerical Algorithms, 3rd ed. Reading, MA: Addison-Wesley, 1998.Landau, E. Handbuch der Lehre von der Verteilung der Primzahlen, 3rd ed. New York: Chelsea, 1974.Mangoldt, H. von. "Zu Riemann's Abhandlung 'Ueber die Anzahl der Primzahlen unter einer gegebenen Grösse.' " J. reine angew. Math. 114, 255-305, 1895.Mathews, G. B. Ch. 10 in Theory of Numbers. New York: Chelsea, 1961.Ribenboim, P. The New Book of Prime Number Records. New York: Springer-Verlag, pp. 224-225, 1996.Riemann, G. F. B. "Über die Anzahl der Primzahlen unter einer gegebenen Grösse." Monatsber. Königl. Preuss. Akad. Wiss. Berlin, 671-680, Nov. 1859. Reprinted in Das Kontinuum und Andere Monographen (Ed. H. Weyl). New York: Chelsea, 1972. Also reprinted in English translation in Edwards, H. M. Appendix. Riemann's Zeta Function. New York: Dover, pp. 299-305, 2001.Riemann, B. "Über die Darstellbarkeit einer Function durch eine trigonometrische Reihe." Reprinted in Gesammelte math. Abhandlungen. New York: Dover, pp. 227-264, 1957.Riesel, H. and Göhl, G. "Some Calculations Related to Riemann's Prime Number Formula." Math. Comput. 24, 969-983, 1970.Riesel, H. "The Riemann Prime Number Formula." Prime Numbers and Computer Methods for Factorization, 2nd ed. Boston, MA: Birkhäuser, pp. 50-52, 1994.Sloane, N. J. A. Sequences A057793, A057794, A096623, A096624, A096625, A143530, A143531 in "The On-Line Encyclopedia of Integer Sequences."Wagon, S. Mathematica in Action. New York: W. H. Freeman, pp. 28-29 and 362-372, 1991.

Referenced on Wolfram|Alpha

Riemann Prime Counting Function

Cite this as:

Weisstein, Eric W. "Riemann Prime Counting Function." From MathWorld--A Wolfram Web Resource.

Subject classifications