PrimePi

PrimePi[n] returns the number of primes less than or equal to n.

Attributes[PrimePi] := {Listable, Protected}

Simple examples

In[1]:= PrimePi[7]
Out[1]= 4
In[2]:= PrimePi[10^6]
Out[2]= 78498
In[3]:= PrimePi[-5]
Out[3]= 0