prime counting function
   HOME

TheInfoList



OR:

In
mathematics Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
, the prime-counting function is the function counting the number of
prime number A prime number (or a prime) is a natural number greater than 1 that is not a Product (mathematics), product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime ...
s less than or equal to some
real number In mathematics, a real number is a number that can be used to measure a continuous one- dimensional quantity such as a duration or temperature. Here, ''continuous'' means that pairs of values can have arbitrarily small differences. Every re ...
. It is denoted by (unrelated to the number ). A symmetric variant seen sometimes is , which is equal to if is exactly a prime number, and equal to otherwise. That is, the number of prime numbers less than , plus half if equals a prime.


Growth rate

Of great interest in
number theory Number theory is a branch of pure mathematics devoted primarily to the study of the integers and arithmetic functions. Number theorists study prime numbers as well as the properties of mathematical objects constructed from integers (for example ...
is the growth rate of the prime-counting function. It was
conjecture In mathematics, a conjecture is a conclusion or a proposition that is proffered on a tentative basis without proof. Some conjectures, such as the Riemann hypothesis or Fermat's conjecture (now a theorem, proven in 1995 by Andrew Wiles), ha ...
d in the end of the 18th century by
Gauss Johann Carl Friedrich Gauss (; ; ; 30 April 177723 February 1855) was a German mathematician, astronomer, Geodesy, geodesist, and physicist, who contributed to many fields in mathematics and science. He was director of the Göttingen Observat ...
and by Legendre to be approximately \frac where is the
natural logarithm The natural logarithm of a number is its logarithm to the base of a logarithm, base of the e (mathematical constant), mathematical constant , which is an Irrational number, irrational and Transcendental number, transcendental number approxima ...
, in the sense that \lim_ \frac=1. This statement is the
prime number theorem In mathematics, the prime number theorem (PNT) describes the asymptotic analysis, asymptotic distribution of the prime numbers among the positive integers. It formalizes the intuitive idea that primes become less common as they become larger by p ...
. An equivalent statement is \lim_\frac=1 where is the
logarithmic integral In mathematics, the logarithmic integral function or integral logarithm li(''x'') is a special function. It is relevant in problems of physics and has number theoretic significance. In particular, according to the prime number theorem, it is a ...
function. The prime number theorem was first proved in 1896 by
Jacques Hadamard Jacques Salomon Hadamard (; 8 December 1865 – 17 October 1963) was a French mathematician who made major contributions in number theory, complex analysis, differential geometry, and partial differential equations. Biography The son of a tea ...
and by Charles de la Vallée Poussin independently, using properties of the
Riemann zeta function The Riemann zeta function or Euler–Riemann zeta function, denoted by the Greek letter (zeta), is a mathematical function of a complex variable defined as \zeta(s) = \sum_^\infty \frac = \frac + \frac + \frac + \cdots for and its analytic c ...
introduced by Riemann in 1859. Proofs of the prime number theorem not using the zeta function or
complex analysis Complex analysis, traditionally known as the theory of functions of a complex variable, is the branch of mathematical analysis that investigates functions of complex numbers. It is helpful in many branches of mathematics, including algebraic ...
were found around 1948 by
Atle Selberg Atle Selberg (14 June 1917 – 6 August 2007) was a Norwegian mathematician known for his work in analytic number theory and the theory of automorphic forms, and in particular for bringing them into relation with spectral theory. He was awarded ...
and by
Paul Erdős Paul Erdős ( ; 26March 191320September 1996) was a Hungarian mathematician. He was one of the most prolific mathematicians and producers of mathematical conjectures of the 20th century. pursued and proposed problems in discrete mathematics, g ...
(for the most part independently).


More precise estimates

In 1899, de la Vallée Poussin proved that \pi(x) = \operatorname (x) + O \left(x e^\right) \quad\text x \to \infty for some positive constant . Here, is the big notation. More precise estimates of are now known. For example, in 2002, Kevin Ford proved that \pi(x) = \operatorname (x) + O \left(x \exp \left( -0.2098(\log x)^ (\log \log x)^ \right) \right). Mossinghoff and Trudgian proved an explicit upper bound for the difference between and : \bigl, \pi(x) - \operatorname(x) \bigr, \le 0.2593 \frac \exp \left( -\sqrt \right) \quad \text x \ge 229. For values of that are not unreasonably large, is greater than . However, is known to change sign infinitely many times. For a discussion of this, see Skewes' number.


Exact form

For let when is a prime number, and otherwise.
Bernhard Riemann Georg Friedrich Bernhard Riemann (; ; 17September 182620July 1866) was a German mathematician who made profound contributions to analysis, number theory, and differential geometry. In the field of real analysis, he is mostly known for the f ...
, in his work ''
On the Number of Primes Less Than a Given Magnitude " die Anzahl der Primzahlen unter einer gegebenen " (usual English translation: "On the Number of Primes Less Than a Given Magnitude") is a seminal 9-page paper by Bernhard Riemann published in the November 1859 edition of the ''Monatsberichte ...
'', proved that is equal to \pi_0(x) = \operatorname(x) - \sum_\operatorname(x^\rho), where \operatorname(x) = \sum_^ \frac \operatorname\left(x^\right), is the
Möbius function The Möbius function \mu(n) is a multiplicative function in number theory introduced by the German mathematician August Ferdinand Möbius (also transliterated ''Moebius'') in 1832. It is ubiquitous in elementary and analytic number theory and m ...
, is the
logarithmic integral function In mathematics, the logarithmic integral function or integral logarithm li(''x'') is a special function. It is relevant in problems of physics and has number theory, number theoretic significance. In particular, according to the prime number the ...
, indexes every zero of the Riemann zeta function, and is not evaluated with a
branch cut In the mathematical field of complex analysis, a branch point of a multivalued function is a point such that if the function is n-valued (has n values) at that point, all of its neighborhoods contain a point that has more than n values. Multi-valu ...
but instead considered as where is the
exponential integral In mathematics, the exponential integral Ei is a special function on the complex plane. It is defined as one particular definite integral of the ratio between an exponential function and its argument. Definitions For real non-zero values of&nb ...
. If the trivial zeros are collected and the sum is taken ''only'' over the non-trivial zeros of the Riemann zeta function, then may be approximated by \pi_0(x) \approx \operatorname(x) - \sum_\operatorname\left(x^\rho\right) - \frac + \frac \arctan . The
Riemann hypothesis In mathematics, the Riemann hypothesis is the conjecture that the Riemann zeta function has its zeros only at the negative even integers and complex numbers with real part . Many consider it to be the most important unsolved problem in pure ...
suggests that every such non-trivial zero lies along .


Table of , , and

The table shows how the three functions , , and compared at powers of 10. See also, and : In the
On-Line Encyclopedia of Integer Sequences The On-Line Encyclopedia of Integer Sequences (OEIS) is an online database of integer sequences. It was created and maintained by Neil Sloane while researching at AT&T Labs. He transferred the intellectual property and hosting of the OEIS to th ...
, the column is sequence , is sequence , and is sequence . The value for was originally computed by J. Buethe, J. Franke, A. Jost, and T. Kleinjung assuming the
Riemann hypothesis In mathematics, the Riemann hypothesis is the conjecture that the Riemann zeta function has its zeros only at the negative even integers and complex numbers with real part . Many consider it to be the most important unsolved problem in pure ...
. It was later verified unconditionally in a computation by D. J. Platt. The value for is by the same four authors. Includes 600,000 value of for The value for was computed by D. B. Staple. 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, 2020, and 2022, respectively.


Algorithms for evaluating

A simple way to find , if is not too large, is to use the
sieve of Eratosthenes In mathematics, the sieve of Eratosthenes is an ancient algorithm for finding all prime numbers up to any given limit. It does so by iteratively marking as composite number, composite (i.e., not prime) the multiples of each prime, starting with ...
to produce the primes less than or equal to and then to count them. A more elaborate way of finding is due to Legendre (using the
inclusion–exclusion principle In combinatorics, the inclusion–exclusion principle is a counting technique which generalizes the familiar method of obtaining the number of elements in the union (set theory), union of two finite sets; symbolically expressed as : , A \cup B, ...
): given , if are distinct prime numbers, then the number of integers less than or equal to which are divisible by no is :\lfloor x\rfloor - \sum_\left\lfloor\frac\right\rfloor + \sum_ \left\lfloor\frac\right\rfloor - \sum_\left\lfloor\frac\right\rfloor + \cdots (where denotes the
floor function In mathematics, the floor function is the function that takes as input a real number , and gives as output the greatest integer less than or equal to , denoted or . Similarly, the ceiling function maps to the least integer greater than or eq ...
). This number is therefore equal to :\pi(x)-\pi\left(\sqrt\right)+1 when the numbers are the prime numbers less than or equal to the square root of .


The Meissel–Lehmer algorithm

In a series of articles published between 1870 and 1885, Ernst Meissel described (and used) a practical combinatorial way of evaluating : Let be the first primes and denote by the number of natural numbers not greater than which are divisible by none of the for any . Then : \Phi(m,n)=\Phi(m,n-1)-\Phi\left(\frac m ,n-1\right). Given a natural number , if and if , then :\pi(m) = \Phi(m,n)+n(\mu+1)+\frac 2 - 1 - \sum_^\mu\pi\left(\frac m \right) . Using this approach, Meissel computed , for equal to , 106, 107, and 108. In 1959, Derrick Henry Lehmer extended and simplified Meissel's method. Define, for real and for natural numbers and , as the number of numbers not greater than with exactly prime factors, all greater than . Furthermore, set . Then :\Phi(m,n) = \sum_^ P_k(m,n) where the sum actually has only finitely many nonzero terms. Let denote an integer such that , and set . Then and when . Therefore, :\pi(m) = \Phi(m,n) + n - 1 - P_2(m,n) The computation of can be obtained this way: :P_2(m,n) = \sum_ \left( \pi \left( \frac m p \right) - \pi(p) + 1\right) where the sum is over prime numbers. On the other hand, the computation of can be done using the following rules: #\Phi(m,0) = \lfloor m\rfloor #\Phi(m,b) = \Phi(m,b-1) - \Phi\left(\frac m,b-1\right) Using his method and an
IBM 701 The IBM 701 Electronic Data Processing Machine, known as the Defense Calculator while in development, was IBM’s first commercial scientific computer and its first series production mainframe computer, which was announced to the public on May 2 ...
, Lehmer was able to compute the correct value of and missed the correct value of by 1. Further improvements to this method were made by Lagarias, Miller, Odlyzko, Deléglise, and Rivat.


Other prime-counting functions

Other prime-counting functions are also used because they are more convenient to work with.


Riemann's prime-power counting function

Riemann's prime-power counting function is usually denoted as or . It has jumps of at prime powers and it takes a value halfway between the two sides at the discontinuities of . That added detail is used because the function may then be defined by an inverse
Mellin transform In mathematics, the Mellin transform is an integral transform that may be regarded as the multiplicative version of the two-sided Laplace transform. This integral transform is closely connected to the theory of Dirichlet series, and is often used ...
. Formally, we may define by :\Pi_0(x) = \frac \left( \sum_ \frac + \sum_ \frac \right)\ where the variable in each sum ranges over all primes within the specified limits. We may also write :\ \Pi_0(x) = \sum_^x \frac - \frac = \sum_^\infty \frac 1 n \pi_0\left(x^\right) where is the
von Mangoldt function In mathematics, the von Mangoldt function is an arithmetic function named after German mathematician Hans von Mangoldt. It is an example of an important arithmetic function that is neither multiplicative nor additive. Definition The von Mang ...
and :\pi_0(x) = \lim_ \frac. The
Möbius inversion formula In mathematics, the classic Möbius inversion formula is a relation between pairs of arithmetic functions, each defined from the other by sums over divisors. It was introduced into number theory in 1832 by August Ferdinand Möbius. A large genera ...
then gives :\pi_0(x) = \sum_^\infty \frac\ \Pi_0\left(x^\right), where is the
Möbius function The Möbius function \mu(n) is a multiplicative function in number theory introduced by the German mathematician August Ferdinand Möbius (also transliterated ''Moebius'') in 1832. It is ubiquitous in elementary and analytic number theory and m ...
. Knowing the relationship between the logarithm of the
Riemann zeta function The Riemann zeta function or Euler–Riemann zeta function, denoted by the Greek letter (zeta), is a mathematical function of a complex variable defined as \zeta(s) = \sum_^\infty \frac = \frac + \frac + \frac + \cdots for and its analytic c ...
and the
von Mangoldt function In mathematics, the von Mangoldt function is an arithmetic function named after German mathematician Hans von Mangoldt. It is an example of an important arithmetic function that is neither multiplicative nor additive. Definition The von Mang ...
, and using the Perron formula we have :\log \zeta(s) = s \int_0^\infty \Pi_0(x) x^\, \mathrmx


Chebyshev's function

The Chebyshev function weights primes or prime powers by : :\begin \vartheta(x) &= \sum_ \log p \\ \psi(x)&=\sum_ \log p = \sum_^\infty \vartheta \left( x^ \right) = \sum_\Lambda(n) . \end For , :\vartheta(x) = \pi(x)\log x - \int_2^x \frac\, \mathrmt and :\pi(x)=\frac + \int_2^x \frac \mathrm t .


Formulas for prime-counting functions

Formulas for prime-counting functions come in two kinds: arithmetic formulas and analytic formulas. Analytic formulas for prime-counting were the first used to prove the
prime number theorem In mathematics, the prime number theorem (PNT) describes the asymptotic analysis, asymptotic distribution of the prime numbers among the positive integers. It formalizes the intuitive idea that primes become less common as they become larger by p ...
. They stem from the work of Riemann and von Mangoldt, and are generally known as explicit formulae. We have the following expression for the second Chebyshev function : :\psi_0(x) = x - \sum_\rho \frac - \log 2\pi - \frac \log\left(1-x^\right), where : \psi_0(x) = \lim_ \frac. 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 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. For we have a more complicated formula :\Pi_0(x) = \operatorname(x) - \sum_\rho \operatorname\left(x^\rho\right) - \log 2 + \int_x^\infty \frac. Again, the formula is valid for , while are the nontrivial zeros of the zeta function ordered according to their absolute value. The first term is the usual
logarithmic integral function In mathematics, the logarithmic integral function or integral logarithm li(''x'') is a special function. It is relevant in problems of physics and has number theory, number theoretic significance. In particular, according to the prime number the ...
; the expression in the second term should be considered as , where is the
analytic continuation In complex analysis, a branch of mathematics, analytic continuation is a technique to extend the domain of definition of a given analytic function. Analytic continuation often succeeds in defining further values of a function, for example in a ne ...
of the
exponential integral In mathematics, the exponential integral Ei is a special function on the complex plane. It is defined as one particular definite integral of the ratio between an exponential function and its argument. Definitions For real non-zero values of&nb ...
function from negative reals to the complex plane with branch cut along the positive reals. The final integral is equal to the series over the trivial zeros: :\int_x^\infty \frac=\int_x^\infty \frac \left(\sum_t^\right)\,\mathrm dt=\sum_\int_x^\infty \frac \,\mathrm dt \,\,\overset-\sum_ \operatorname\left(x^\right) Thus,
Möbius inversion formula In mathematics, the classic Möbius inversion formula is a relation between pairs of arithmetic functions, each defined from the other by sums over divisors. It was introduced into number theory in 1832 by August Ferdinand Möbius. A large genera ...
gives us :\pi_0(x) = \operatorname(x) - \sum_\operatorname\left(x^\rho\right) - \sum_ \operatorname\left(x^\right) valid for , where :\operatorname(x) = \sum_^ \frac \operatorname\left(x^\right) = 1 + \sum_^\infty \frac is Riemann's R-function and is the
Möbius function The Möbius function \mu(n) is a multiplicative function in number theory introduced by the German mathematician August Ferdinand Möbius (also transliterated ''Moebius'') in 1832. It is ubiquitous in elementary and analytic number theory and m ...
. The latter series for it is known as
Gram The gram (originally gramme; SI unit symbol g) is a Physical unit, unit of mass in the International System of Units (SI) equal to one thousandth of a kilogram. Originally defined in 1795 as "the absolute Mass versus weight, weight of a volume ...
series. Because for all , this series converges for all positive by comparison with the series for . The logarithm in the Gram series of the sum over the non-trivial zero contribution should be evaluated as and not . Folkmar Bornemann proved, when assuming the
conjecture In mathematics, a conjecture is a conclusion or a proposition that is proffered on a tentative basis without proof. Some conjectures, such as the Riemann hypothesis or Fermat's conjecture (now a theorem, proven in 1995 by Andrew Wiles), ha ...
that all zeros of the Riemann zeta function are simple, Montgomery showed that (assuming the Riemann hypothesis) at least two thirds of all zeros are simple. that :\operatorname\left(e^\right)=\frac\sum_^\infty\frac+\frac12\sum_\frac where runs over the non-trivial zeros of the Riemann zeta function and . The sum over non-trivial zeta zeros in the formula for describes the fluctuations of while the remaining terms give the "smooth" part of prime-counting function, so one can use :\operatorname(x) - \sum_^\infty \operatorname\left(x^\right) as a good estimator of for . In fact, since the second term approaches 0 as , while the amplitude of the "noisy" part is heuristically about , estimating by alone is just as good, and fluctuations of the distribution of primes may be clearly represented with the function :\bigl( \pi_0(x) - \operatorname(x)\bigr) \frac.


Inequalities

Ramanujan proved that the inequality :\pi(x)^2 < \frac \pi\left( \frac \right) holds for all sufficiently large values of . Here are some useful inequalities for . : \frac x < \pi(x) < 1.25506 \frac x \quad \textx \ge 17. The left inequality holds for and the right inequality holds for . The constant is to 5 decimal places, as has its maximum value at . Pierre Dusart proved in 2010: : \frac < \pi(x) < \frac \quad \textx \ge 5393 \textx \ge 60184,\text More recently, Dusart has proved (Theorem 5.1) that :\frac \left( 1 + \frac + \frac \right) \le \pi(x) \le \frac \left( 1 + \frac + \frac + \frac \right), for and , respectively. Going in the other direction, an approximation for the th prime, , is :p_n = n \left(\log n + \log\log n - 1 + \frac + O\left( \frac \right)\right). Here are some inequalities for the th prime. The lower bound is due to Dusart (1999) and the upper bound to Rosser (1941). : n (\log n + \log\log n - 1) < p_n < n (\log n + \log\log n)\quad \text n \ge 6. The left inequality holds for and the right inequality holds for . A variant form sometimes seen substitutes \log n +\log\log n = \log(n \log n). An even simpler lower bound is :n \log n < p_n, which holds for all , but the lower bound above is tighter for . In 2010 Dusart proved (Propositions 6.7 and 6.6) that : n \left( \log n + \log \log n - 1 + \frac \right) \le p_n \le n \left( \log n + \log \log n - 1 + \frac \right), for and , respectively. In 2024, Axler further tightened this (equations 1.12 and 1.13) using bounds of the form : f(n,g(w)) = n \left( \log n + \log\log n - 1 + \frac - \frac \right) proving that : f(n, w^2 - 6w + 11.321) \le p_n \le f(n, w^2 - 6w) for and , respectively. The lower bound may also be simplified to without altering its validity. The upper bound may be tightened to if . There are additional bounds of varying complexity.


The Riemann hypothesis

The
Riemann hypothesis In mathematics, the Riemann hypothesis is the conjecture that the Riemann zeta function has its zeros only at the negative even integers and complex numbers with real part . Many consider it to be the most important unsolved problem in pure ...
implies a much tighter bound on the error in the estimate for , and hence to a more regular distribution of prime numbers, :\pi(x) = \operatorname(x) + O(\sqrt \log). Specifically, :, \pi(x) - \operatorname(x), < \frac \, \log, \quad \text x \ge 2657. proved that the Riemann hypothesis implies that for all there is a prime satisfying :x - \frac \sqrt \log x < p \leq x.


See also

*
Bertrand's postulate In number theory, Bertrand's postulate is the theorem that for any integer n > 3, there exists at least one prime number p with :n < p < 2n - 2. A less restrictive formulation is: for every n > 1, there is always at least one ...
* Oppermann's conjecture * Ramanujan prime


References


Notes


External links

*Chris Caldwell
''The Nth Prime Page''
at The
Prime Pages The PrimePages is a website about prime number A prime number (or a prime) is a natural number greater than 1 that is not a Product (mathematics), product of two smaller natural numbers. A natural number greater than 1 that is not prime is ...
. *Tomás Oliveira e Silva
Tables of prime-counting functions
* {{DEFAULTSORT:Prime-Counting Function Analytic number theory Prime numbers Arithmetic functions