Number of primes up to a given bound
This functionality does not run in MATLAB.
numlib::pi(x) returns the number of primes not exceeding x.
If the argument x is a real number (an integer, rational, or floating-point number), then the number of primes below x is returned. If x is a complex number, numlib::pi stops with an error. For every other kind of arithmetical expression x, an unevaluated call is returned.
numlib::pi becomes slightly faster if the internal prime number table is large. ifactor(PrimeLimit) displays the limit of the internal prime number table; it can be set by the user via the command line flag -L.
Internally, a fast kernel function with constant memory consumption is used for the computation.
There are two primes less or equal 3:
Also larger inputs can be handled fast:
Floating point arguments are allowed, too.
A Lehmer-type algorithm is used, with no precomputed sieve array and no remember tables. In contrast to the algorithm in "Computing π: The Meissel-Lehmer method", this means constant memory consumption, at the price of slowness.
 Lagarias, J.C., V.S. Miller, and A.M. Odlyzko. "Computing π: The Meissel-Lehmer method", Math. Comp., Vol. 44, No. 170 (1985), pp. 537-560