Misplaced Pages

Prime-counting function

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

This is an old revision of this page, as edited by 68.154.65.92 (talk) at 23:41, 28 December 2004. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Revision as of 23:41, 28 December 2004 by 68.154.65.92 (talk)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

In mathematics, a prime-counting function is any of many methods that count prime numbers.

Historically there are several such methods. Traditionally the prime counting function is given as π ( x ) {\displaystyle \pi (x)} , for instance, π ( 1000 ) = 168 {\displaystyle \pi (1000)=168} as there are 168 primes up to 1000.

Prime counting itself has been eclipsed by research on the Riemann Hypothesis formulated by Bernhard Riemann.

His work was a continuation of research relating prime numbers to continuous functions that included important figures like Carl Friedrich Gauss who along with others noticed that

π ( x ) x ln ( x ) {\displaystyle \pi (x)\approx {\frac {x}{\ln(x)}}}

which lead to the relation known as the prime number theorem where an important figure in the history before Riemann is Pafnuty Chebyshev who used the Euler zeta function, which Riemann expanded into the complex plane by analytic continuation to get the Riemann zeta function.

One compact method for actually counting primes is the following recursive function:

With natural numbers x and y, if y x {\displaystyle y\leq {\sqrt {x}}} then

p ( x , y ) = f l o o r ( x ) 1 k = 2 y ( ( p ( x / k , k 1 ) p ( k 1 , k 1 ) ) ( p ( k , k ) p ( k 1 , k 1 ) ) ) {\displaystyle p(x,y)=\mathrm {floor} (x)-1-\sum _{k=2}^{y}{((p(x/k,k-1)-p(k-1,{\sqrt {k-1}}))(p(k,{\sqrt {k}})-p(k-1,{\sqrt {k-1}})))}}

else p ( x , y ) = p ( x , x ) {\displaystyle p(x,y)=p(x,{\sqrt {x}})} .

Here π ( x ) = p ( x , x ) {\displaystyle \pi (x)=p(x,{\sqrt {x}})} gives the count of prime numbers.

The method relies on the inclusion-exclusion principle as well as a few other ideas, and bears remarkable similarities to other less compactly represented prime counting functions, like Legendre's Formula discovered by the French mathematicians Adrien-Marie Legendre and Meissel's Formula discovered by the German mathematician Ernst Meissel.

The discrete summation is of a partial difference equation with the constraint that y x {\displaystyle y\leq {\sqrt {x}}} .

The method finds prime numbers as it recurses, and far faster algorithms can be developed from it by instead using a sieve like the Sieve of Eratosthenes to get the prime numbers up to x {\displaystyle {\sqrt {x}}} versus letting the formula find them.

Some values calculated for this article from one such algorithm:

p ( 10 , 3 ) {\displaystyle p(10,3)} 4
p ( 100 , 10 ) {\displaystyle p(100,10)} 25
p ( 1000 , 31 ) {\displaystyle p(1000,31)} 168
p ( 10000 , 100 ) {\displaystyle p(10000,100)} 1229
p ( 10 5 , 316 ) {\displaystyle p(10^{5},316)} 9592
p ( 10 6 , 1000 ) {\displaystyle p(10^{6},1000)} 78498
p ( 10 7 , 3162 ) {\displaystyle p(10^{7},3162)} 664579
p ( 10 8 , 10 4 ) {\displaystyle p(10^{8},10^{4})} 5761455
p ( 10 9 , 31622 ) {\displaystyle p(10^{9},31622)} 50847534
p ( 10 10 , 10 5 ) {\displaystyle p(10^{10},10^{5})} 455052511
p ( 10 11 , 316227 ) {\displaystyle p(10^{11},316227)} 4118054813
p ( 10 12 , 10 6 ) {\displaystyle p(10^{12},10^{6})} 37607912018


See also: floor function

This article is a stub. You can help Misplaced Pages by expanding it.