Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Number Theory > Prime Numbers > PrimePi >
Mathematica > Mathematics and Algorithms > Mathematical Functions > Number Theoretic Functions > Prime Numbers > PrimePi >

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
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF