PrimePi
PrimePi[x]
gives the number of primes less than or equal to x.
Details and Options
- PrimePi is also known as prime counting function.
- Mathematical function, suitable for both symbolic and numerical manipulation.
- counts the prime numbers less than or equal to x.
- has the asymptotic expansion as .
- The following option can be given:
-
Method Automatic method to use ProgressReporting $ProgressReporting whether to report the progress of the computation - Possible settings for Method include:
-
"DelegliseRivat" use the Deléglise–Rivat algorithm "Legendre" use the Legendre formula "Lehmer" use the Lehmer formula "LMO" use the Lagarias–Miller–Odlyzko algorithm "Meissel" use the Meissel formula "Sieve" use the sieve of Erastosthenes
Examples
open allclose allBasic Examples (3)
Scope (10)
Numerical Evaluation (5)
Options (6)
Method (5)
Specify the Legendre method to be used for counting primes [MathWorld]:
Specify the Lehmer method to be used for counting primes [MathWorld]:
Specify the Deléglise–Rivat method to be used for counting primes:
Specify the Meissel method to be used for counting primes [MathWorld]:
Specify the Lagarias–Miller–Odlyzko (LMO) to be used for counting primes:
ProgressReporting (1)
By default, PrimePi does not report progress:
With the setting ProgressReporting->True, PrimePi shows the progress of the computation:
Applications (22)
Basic Applications (7)
Approximations (7)
Number Theory (8)
Find twin primes up to , i.e. pairs of primes of the form :
Plot the sequence of twin primes and PrimePi:
The Ramanujan prime is the smallest number such that for all :
Plot the sequence of Ramanujan primes:
Compare the count of Ramanujan primes to PrimePi:
Calculate the primorial up to the prime, i.e. a function that multiplies successive primes, similar to the factorial:
Compare the primorial to the factorial up to :
Plot the differences between the factorial and the primorial up to :
Plot the Chebyshev theta function:
Calculate the prime powers up to :
Count all the prime powers up to :
Graph the count of prime powers:
Compare the count of prime powers to PrimePi:
Visualize the second Hardy–Littlewood conjecture, which states that for :
Plot Brocard's conjecture, which states that if and are consecutive primes greater than 2, then between and there are at least four prime numbers:
Find Goldbach partitions, i.e. pairs of primes (, ) such that :
Properties & Relations (5)
Text
Wolfram Research (1991), PrimePi, Wolfram Language function, https://reference.wolfram.com/language/ref/PrimePi.html (updated 2021).
CMS
Wolfram Language. 1991. "PrimePi." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/PrimePi.html.
APA
Wolfram Language. (1991). PrimePi. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PrimePi.html