In number theory, the function pi(x) is defined to be the number of primes less than or equal to x. For example, pi(3)=2 since 2 and 3 are prime.

There have been many attempts to approximate the value of pi(x) for any given x. The logarithmic integral is one approximation of pi(x); indeed, in the limit (as x approaches infinity), the ratio pi(x)/Li(x) approaches one. This is one of the underlying results of the prime number theorem. Another famous approximation is given by Riemann and is based the logarithmic integral and the Mobius numbers:

 \    u(n)    /  1/n \
 /   -----*li | x    |
/      n      \      /

Where u(n) is the nth Mobius number. For most values of x, Riemann's estimate is among the best. But, whenever Li(x)<pi(x) (see Skewes number), Riemann's estimate is worse than many others.

For related information, see the Node of Prime, prime number and the Riemann zeta function. Note that since there are an infinite number of primes, pi(x) returns the value of every natural number at least once.

According to, the upper bound for pi(x) is (2x-6)/ln(x), where ln(x) is the natural logarithm of x.