Prime-Counting Function
Prime-Counting Function
Growth rate
Of great interest in number theory is the growth rate of The values of π(n) for the first 60 positive integers
the prime-counting function.[3][4] It was conjectured in
the end of the 18th century by Gauss and by Legendre to
be approximately
where li is the logarithmic integral function. The prime number theorem was first proved in 1896 by Jacques
Hadamard and by Charles de la Vallée Poussin independently, using properties of the Riemann zeta function
introduced by Riemann in 1859. Proofs of the prime number theorem not using the zeta function or complex analysis
were found around 1948 by Atle Selberg and by Paul Erdős (for the most part independently).[5]
More precise estimates of π(x) are now known. For example, in 2002, Kevin Ford proved that[7]
Mossinghoff and Trudgian proved[8] an explicit upper bound for the difference between π(x) and li(x):
For values of x that are not unreasonably large, li(x) is greater than π(x). However, π(x) − li(x) is known to change
sign infinitely many times. For a discussion of this, see Skewes' number.
Exact form
1
For x > 1 let π0(x) = π(x) − when x is a prime number, and π0(x) = π(x) otherwise. Bernhard Riemann, in his
2
work On the Number of Primes Less Than a Given Magnitude, proved that π0(x) is equal to[9]
where
1
The Riemann hypothesis suggests that every such non-trivial zero lies along Re(s) = .
2
x
Table of π(x), log x , and li(x)
x
The table shows how the three functions π(x), log x , and li(x) compared at powers of 10. See also,[3][11] and[12]
x
x x log x
x π(x) π(x) − log x li(x) − π(x) π(x)
% error
10 4 0 2 2.500 −8.57%
x
In the On-Line Encyclopedia of Integer Sequences, the π(x) column is sequence OEIS: A006880, π(x) −
log x
is
sequence OEIS: A057835, and li(x) − π(x) is sequence OEIS: A057752.
The value for π(1024) was originally computed by J. Buethe, J. Franke, A. Jost, and T. Kleinjung assuming the
Riemann hypothesis.[13] It was later verified unconditionally in a computation by D. J. Platt.[14] The value for π(1025)
is by the same four authors.[15] The value for π(1026) was computed by D. B. Staple.[16] All other prior entries in this
table were also verified as part of that work.
The values for 1027, 1028, and 1029 were announced by David Baugh
and Kim Walisch in 2015,[17] 2020,[18] and 2022,[19] respectively.
A more elaborate way of finding π(x) is due to Legendre (using the Graph showing ratio of the prime-counting
x
inclusion–exclusion principle): given x, if p1, p2,…, pn are distinct function π(x) to two of its approximations, log x
prime numbers, then the number of integers less than or equal to x and Li(x). As x increases (note x-axis is
which are divisible by no pi is logarithmic), both ratios tend towards 1. The ratio
x
for converges from above very slowly, while
log x
the ratio for Li(x) converges more quickly from
below.
(where ⌊x⌋ denotes the floor function). This number is therefore equal
to
when the numbers p1, p2,…, pn are the prime numbers less than or equal to the square root of x.
3
Given a natural number m, if n = π(√m ) and if μ = π(√m ) − n, then
Using this approach, Meissel computed π(x), for x equal to 5 × 105, 106, 107, and 108.
In 1959, Derrick Henry Lehmer extended and simplified Meissel's method. Define, for real m and for natural
numbers n and k, Pk(m,n) as the number of numbers not greater than m with exactly k prime factors, all greater than
pn. Furthermore, set P0(m,n) = 1. Then
3
where the sum actually has only finitely many nonzero terms. Let y denote an integer such that √m ≤ y ≤ √m , and
set n = π(y). Then P1(m,n) = π(m) − n and Pk(m,n) = 0 when k ≥ 3. Therefore,
The computation of P2(m,n) can be obtained this way:
On the other hand, the computation of Φ(m,n) can be done using the following rules:
1.
2.
Using his method and an IBM 701, Lehmer was able to compute the correct value of π(109) and missed the correct
value of π(1010) by 1.[20]
Further improvements to this method were made by Lagarias, Miller, Odlyzko, Deléglise, and Rivat.[21]
where the variable p in each sum ranges over all primes within the specified limits.
Chebyshev's function
The Chebyshev function weights primes or prime powers pn by log p:
For x ≥ 2,[22]
and
where
Here ρ are the zeros of the Riemann zeta function in the critical strip, where the real part of ρ is between zero and
one. The formula is valid for values of x greater than one, which is the region of interest. The sum over the roots is
conditionally convergent, and should be taken in order of increasing absolute value of the imaginary part. Note that
the same sum over the trivial roots gives the last subtrahend in the formula.
is Riemann's R-function[24] and μ(n) is the Möbius function. The latter series for it is known as Gram series.[25][26]
Because log x < x for all x > 0, this series converges for all positive x by comparison with the series for ex. The
logarithm in the Gram series of the sum over the non-trivial zero contribution should be evaluated as ρ log x and not
log xρ.
Folkmar Bornemann proved,[27] when assuming the conjecture that all zeros of the Riemann zeta function are
simple,[note 1] that
where ρ runs over the non-trivial zeros of the Riemann zeta function and t > 0.
The sum over non-trivial zeta zeros in the formula for π0(x) describes the fluctuations of π0(x) while the remaining
terms give the "smooth" part of prime-counting function,[28] so one can use
as a good estimator of π(x) for x > 1. In fact, since the second term approaches 0 as x → ∞, while the amplitude of
√x
the "noisy" part is heuristically about , estimating π(x) by R(x) alone is just as good, and fluctuations of the
log x
distribution of primes may be clearly represented with the function
Inequalities
Ramanujan[29] proved that the inequality
holds for all sufficiently large values of x.
log 113
The left inequality holds for x ≥ 17 and the right inequality holds for x > 1. The constant 1.25506 is 30 113 to 5
log x
decimal places, as π(x) x has its maximum value at x = p30 = 113.[30]
Going in the other direction, an approximation for the nth prime, pn, is
Here are some inequalities for the nth prime. The lower bound is due to Dusart (1999)[33] and the upper bound to
Rosser (1941).[34]
The left inequality holds for n ≥ 2 and the right inequality holds for n ≥ 6. A variant form sometimes seen substitutes
An even simpler lower bound is[35]
which holds for all n ≥ 1, but the lower bound above is tighter for n > ee ≈15.154.
In 2024, Axler[36] further tightened this (equations 1.12 and 1.13) using bounds of the form
proving that
for n ≥ 2 and n ≥ 3468, respectively. The lower bound may also be simplified to f(n, w2) without altering its validity.
The upper bound may be tightened to f(n, w2 − 6w + 10.667) if n ≥ 46254381.
Specifically,[40]
Dudek (2015) proved that the Riemann hypothesis implies that for all x ≥ 2 there is a prime p satisfying
See also
Bertrand's postulate
Oppermann's conjecture
Ramanujan prime
References
1. Bach, Eric; Shallit, Jeffrey (1996). Algorithmic Number Theory. MIT Press. volume 1 page 234 section 8.8.
ISBN 0-262-02405-5.
2. Weisstein, Eric W. "Prime Counting Function" (https://mathworld.wolfram.com/PrimeCountingFunction.html).
MathWorld.
3. "How many primes are there?" (https://web.archive.org/web/20121015002415/http://primes.utm.edu/howmany.sh
tml). Chris K. Caldwell. Archived from the original (http://primes.utm.edu/howmany.shtml) on 2012-10-15.
Retrieved 2008-12-02.
4. Dickson, Leonard Eugene (2005). History of the Theory of Numbers, Vol. I: Divisibility and Primality. Dover
Publications. ISBN 0-486-44232-2.
5. Ireland, Kenneth; Rosen, Michael (1998). A Classical Introduction to Modern Number Theory (Second ed.).
Springer. ISBN 0-387-97329-X.
6. See also Theorem 23 of A. E. Ingham (2000). The Distribution of Prime Numbers. Cambridge University Press.
ISBN 0-521-39789-8.
7. Kevin Ford (November 2002). "Vinogradov's Integral and Bounds for the Riemann Zeta Function" (https://faculty.
math.illinois.edu/~ford/wwwpapers/zetabd.pdf) (PDF). Proc. London Math. Soc. 85 (3): 565–633.
arXiv:1910.08209 (https://arxiv.org/abs/1910.08209). doi:10.1112/S0024611502013655 (https://doi.org/10.1112%
2FS0024611502013655). S2CID 121144007 (https://api.semanticscholar.org/CorpusID:121144007).
8. Mossinghoff, Michael J.; Trudgian, Timothy S. (2015). "Nonnegative trigonometric polynomials and a zero-free
region for the Riemann zeta-function". J. Number Theory. 157: 329–349. arXiv:1410.3926 (https://arxiv.org/abs/1
410.3926). doi:10.1016/J.JNT.2015.05.010 (https://doi.org/10.1016%2FJ.JNT.2015.05.010). S2CID 117968965 (h
ttps://api.semanticscholar.org/CorpusID:117968965).
9. Hutama, Daniel (2017). "Implementation of Riemann's Explicit Formula for Rational and Gaussian Primes in
Sage" (http://ism.uqam.ca/~ism/pdf/Hutama-scientific%20report.pdf) (PDF). Institut des sciences mathématiques.
10. Riesel, Hans; Göhl, Gunnar (1970). "Some calculations related to Riemann's prime number formula" (https://ww
w.ams.org/journals/mcom/1970-24-112/S0025-5718-1970-0277489-3/S0025-5718-1970-0277489-3.pdf) (PDF).
Mathematics of Computation. 24 (112). American Mathematical Society: 969–983. doi:10.2307/2004630 (https://d
oi.org/10.2307%2F2004630). ISSN 0025-5718 (https://search.worldcat.org/issn/0025-5718). JSTOR 2004630 (htt
ps://www.jstor.org/stable/2004630). MR 0277489 (https://mathscinet.ams.org/mathscinet-getitem?mr=0277489).
11. "Tables of values of π(x) and of π2(x)" (https://sweet.ua.pt/tos/primes.html). Tomás Oliveira e Silva. Retrieved
2024-03-31.
12. "A table of values of π(x)" (http://numbers.computation.free.fr/Constants/Primes/pixtable.html). Xavier Gourdon,
Pascal Sebah, Patrick Demichel. Retrieved 2008-09-14.
13. Franke, Jens (2010-07-29). "Conditional Calculation of π(1024)" (https://t5k.org/notes/pi(10to24).html). Chris K.
Caldwell. Retrieved 2024-03-30.
14. Platt, David J. (May 2015) [March 2012]. "Computing π(x) Analytically" (https://doi.org/10.1090%2FS0025-5718-2
014-02884-6). Mathematics of Computation. 84 (293): 1521–1535. arXiv:1203.5712 (https://arxiv.org/abs/1203.57
12). doi:10.1090/S0025-5718-2014-02884-6 (https://doi.org/10.1090%2FS0025-5718-2014-02884-6).
15. "Analytic Computation of the prime-counting Function" (http://www.math.uni-bonn.de/people/jbuethe/topics/Analyt
icPiX.html). J. Buethe. 27 May 2014. Retrieved 2015-09-01. Includes 600,000 value of π(x) for
1014 ≤ x ≤ 1.6×1018
16. Staple, Douglas (19 August 2015). The combinatorial algorithm for computing π(x) (http://dalspace.library.dal.ca/h
andle/10222/60524) (Thesis). Dalhousie University. Retrieved 2015-09-01.
17. Walisch, Kim (September 6, 2015). "New confirmed π(1027) prime counting function record" (http://www.mersenn
eforum.org/showthread.php?t=20473). Mersenne Forum.
18. Baugh, David (August 30, 2020). "New prime counting function record, pi(10^28)" (https://www.mersenneforum.or
g/showpost.php?p=555434&postcount=28). Mersenne Forum.
19. Walisch, Kim (March 4, 2022). "New prime counting function record: PrimePi(10^29)" (https://www.mersenneforu
m.org/showpost.php?p=601061&postcount=38). Mersenne Forum.
20. Lehmer, Derrick Henry (1 April 1958). "On the exact number of primes less than a given limit" (https://projecteucli
d.org/download/pdf_1/euclid.ijm/1255455259). Illinois J. Math. 3 (3): 381–388. Retrieved 1 February 2017.
21. Deléglise, Marc; Rivat, Joel (January 1996). "Computing π(x): The Meissel, Lehmer, Lagarias, Miller, Odlyzko
method" (https://www.ams.org/mcom/1996-65-213/S0025-5718-96-00674-6/S0025-5718-96-00674-6.pdf) (PDF).
Mathematics of Computation. 65 (213): 235–245. doi:10.1090/S0025-5718-96-00674-6 (https://doi.org/10.1090%
2FS0025-5718-96-00674-6).
22. Apostol, Tom M. (2010). Introduction to Analytic Number Theory. Springer. ISBN 978-1441928054.
23. Titchmarsh, E.C. (1960). The Theory of Functions, 2nd ed. Oxford University Press.
24. Weisstein, Eric W. "Riemann Prime Counting Function" (https://mathworld.wolfram.com/RiemannPrimeCountingF
unction.html). MathWorld.
25. Riesel, Hans (1994). Prime Numbers and Computer Methods for Factorization. Progress in Mathematics.
Vol. 126 (2nd ed.). Birkhäuser. pp. 50–51. ISBN 0-8176-3743-5.
26. Weisstein, Eric W. "Gram Series" (https://mathworld.wolfram.com/GramSeries.html). MathWorld.
27. Bornemann, Folkmar. "Solution of a Problem Posed by Jörg Waldvogel" (https://www-m3.ma.tum.de/bornemann/
RiemannRZero.pdf) (PDF).
28. "The encoding of the prime distribution by the zeta zeros" (http://www.secamlocal.ex.ac.uk/people/staff/mrwatkin/
zeta/encoding1.htm). Matthew Watkins. Retrieved 2008-09-14.
29. Berndt, Bruce C. (2012-12-06). Ramanujan's Notebooks, Part IV (https://books.google.com/books?id=QoMHCAA
AQBAJ). Springer Science & Business Media. pp. 112–113. ISBN 9781461269328.
30. Rosser, J. Barkley; Schoenfeld, Lowell (1962). "Approximate formulas for some functions of prime numbers" (http
s://projecteuclid.org/euclid.ijm/1255631807). Illinois J. Math. 6: 64–94. doi:10.1215/ijm/1255631807 (https://doi.or
g/10.1215%2Fijm%2F1255631807). ISSN 0019-2082 (https://search.worldcat.org/issn/0019-2082).
Zbl 0122.05001 (https://zbmath.org/?format=complete&q=an:0122.05001).
31. Dusart, Pierre (2 Feb 2010). "Estimates of Some Functions Over Primes without R.H.". arXiv:1002.0442v1 (http
s://arxiv.org/abs/1002.0442v1) [math.NT (https://arxiv.org/archive/math.NT)].
32. Dusart, Pierre (January 2018). "Explicit estimates of some functions over primes". Ramanujan Journal. 45 (1):
225–234. doi:10.1007/s11139-016-9839-4 (https://doi.org/10.1007%2Fs11139-016-9839-4). S2CID 125120533 (h
ttps://api.semanticscholar.org/CorpusID:125120533).
33. Dusart, Pierre (January 1999). "The kth prime is greater than k(ln k + ln ln k − 1) for k ≥ 2" (https://www.ams.org/m
com/1999-68-225/S0025-5718-99-01037-6/S0025-5718-99-01037-6.pdf) (PDF). Mathematics of Computation. 68
(225): 411–415. Bibcode:1999MaCom..68..411D (https://ui.adsabs.harvard.edu/abs/1999MaCom..68..411D).
doi:10.1090/S0025-5718-99-01037-6 (https://doi.org/10.1090%2FS0025-5718-99-01037-6).
34. Rosser, Barkley (January 1941). "Explicit bounds for some functions of prime numbers". American Journal of
Mathematics. 63 (1): 211–232. doi:10.2307/2371291 (https://doi.org/10.2307%2F2371291). JSTOR 2371291 (htt
ps://www.jstor.org/stable/2371291).
35. Rosser, J. Barkley; Schoenfeld, Lowell (March 1962). "Approximate formulas for some functions of prime
numbers". Illinois Journal of Mathematics. 6 (1): 64–94. doi:10.1215/ijm/1255631807 (https://doi.org/10.1215%2F
ijm%2F1255631807).
36. Axler, Christian (2019) [23 Mar 2017]. "New estimates for the nth prime number" (https://cs.uwaterloo.ca/journals/
JIS/VOL22/Axler/axler17.html). Journal of Integer Sequences. 19 (4) 2. arXiv:1706.03651 (https://arxiv.org/abs/17
06.03651).
37. "Bounds for n-th prime" (https://math.stackexchange.com/questions/1270814/bounds-for-n-th-prime).
Mathematics StackExchange. 31 December 2015.
38. Axler, Christian (2018) [23 Mar 2017]. "New Estimates for Some Functions Defined Over Primes" (https://math.co
lgate.edu/~integers/s52/s52.pdf) (PDF). Integers. 18 A52. arXiv:1703.08032 (https://arxiv.org/abs/1703.08032).
doi:10.5281/zenodo.10677755 (https://doi.org/10.5281%2Fzenodo.10677755).
39. Axler, Christian (2024) [11 Mar 2022]. "Effective Estimates for Some Functions Defined over Primes" (https://mat
h.colgate.edu/~integers/y34/y34.pdf) (PDF). Integers. 24 A34. arXiv:2203.05917 (https://arxiv.org/abs/2203.0591
7). doi:10.5281/zenodo.10677755 (https://doi.org/10.5281%2Fzenodo.10677755).
40. Schoenfeld, Lowell (1976). "Sharper bounds for the Chebyshev functions θ(x) and ψ(x). II". Mathematics of
Computation. 30 (134). American Mathematical Society: 337–360. doi:10.2307/2005976 (https://doi.org/10.230
7%2F2005976). ISSN 0025-5718 (https://search.worldcat.org/issn/0025-5718). JSTOR 2005976 (https://www.jsto
r.org/stable/2005976). MR 0457374 (https://mathscinet.ams.org/mathscinet-getitem?mr=0457374).
Notes
1. Montgomery showed that (assuming the Riemann hypothesis) at least two thirds of all zeros are simple.
External links
Chris Caldwell, The Nth Prime Page (http://primes.utm.edu/nthprime/) at The Prime Pages.
Tomás Oliveira e Silva, Tables of prime-counting functions (http://sweet.ua.pt/tos/primes.html).
Dudek, Adrian W. (2015), "On the Riemann hypothesis and the difference between primes", International Journal
of Number Theory, 11 (3): 771–778, arXiv:1402.6417 (https://arxiv.org/abs/1402.6417),
Bibcode:2014arXiv1402.6417D (https://ui.adsabs.harvard.edu/abs/2014arXiv1402.6417D),
doi:10.1142/S1793042115500426 (https://doi.org/10.1142%2FS1793042115500426), ISSN 1793-0421 (https://se
arch.worldcat.org/issn/1793-0421), S2CID 119321107 (https://api.semanticscholar.org/CorpusID:119321107)