Prime Counting - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

NumberTheory

 PrimeCounting
 number of prime numbers less than a number

 Calling Sequence PrimeCounting(x) pi(x)

Parameters

 x - positive real number

Description

 • The PrimeCounting(x) command computes the number of prime numbers less than or equal to x.
 • pi is an alias of PrimeCounting.

Examples

 > $\mathrm{with}\left(\mathrm{NumberTheory}\right):$
 > $\mathrm{PrimeCounting}\left(1\right)$
 ${0}$ (1)
 > $\mathrm{pi}\left(\mathrm{Pi}\right)$
 ${2}$ (2)
 > $\mathrm{PrimeCounting}\left(10000\right)$
 ${1229}$ (3)
 > $\mathrm{numelems}\left(\mathrm{select}\left(\mathrm{isprime},\left[\mathrm{seq}\left(1..10000\right)\right]\right)\right)$
 ${1229}$ (4)

The prime counting function is approximated by $\mathrm{Li}\left(x\right)$ and $\frac{x}{\mathrm{ln}\left(x\right)}$.

 > $\mathrm{plot}\left(\left[\mathrm{PrimeCounting}\left(x\right),\mathrm{Li}\left(x\right),\frac{x}{\mathrm{ln}\left(x\right)}\right],x=1..500,\mathrm{legend}=\left[\mathrm{pi}\left(x\right),\mathrm{Li}\left(x\right),\frac{x}{\mathrm{ln}\left(x\right)}\right]\right)$

Compatibility

 • The NumberTheory[PrimeCounting] command was introduced in Maple 2016.
 • For more information on Maple 2016 changes, see Updates in Maple 2016.

 See Also