This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

PrimePi

PrimePi[x]
gives the number of primes less than or equal to x.
  • Integer mathematical function, suitable for both symbolic and numerical manipulation.
  • The argument of PrimePi can be any positive real number.
  • PrimePi automatically threads over lists.
The number of primes up to a billion:
PrimePi increases every time there is a prime:
The number of primes up to a billion:
In[1]:=
Click for copyable input
Out[1]=
 
PrimePi increases every time there is a prime:
In[1]:=
Click for copyable input
Out[1]=
PrimePi takes continuous arguments, but gives integer values:
TraditionalForm formatting:
Plot PrimePi compared with estimates:
Compute PrimePi based on the Hardy-Wright formula:
For primes, Prime is effectively the inverse of PrimePi:
Integrate :
New in 2