Prime
Prime[n]
gives the nprime number
.
Details

- Prime is also known as prime number sequence.
- Integer mathematical function, suitable for both symbolic and numerical manipulation.
is the smallest positive integer greater than
, which cannot be divided by any integer greater than 1 and smaller than itself. The first prime
is the integer 2.
is asymptotically equivalent to
as
.

Examples
open allclose allBasic Examples (3)
Scope (10)
Numerical Evaluation (4)
Applications (38)
Basic Applications (9)
Visualize the primes with a parabolic sieve:
Visualize the sieve of Eratosthenes for the first 5 primes:
Find the lowest-divisor pair for an integer :
Find the factorization for an integer :
Construct a factorization tree for an integer :
Visualize prime numbers with periodic curves. Prime numbers are those where only two curves cross—its own and the curve of 1:
Approximations (3)
Number Theory (14)
Plot of the first 50 primes modulo 6:
Fraction of the first million primes greater than 3 of the form :
With the exception of 2 and 3, all primes are of the form :
Define a residue number system:
Choose two numbers and represent them in the residue system:
Multiplying and recovering in the residue system:
An approximation to the zeta function:
Calculate the probability that a number is relatively prime to the first 25 primes:
Differences between the first 100 primes:
Find the jumping champion, i.e. the most frequently occurring difference between consecutive primes:
Calculate the sum of prime factors:
Plot the sum of prime factors for the first 25 integers:
Find Goldbach partitions, i.e. pairs of primes (,
) such that
:
Graph Goldbach's conjecture/comet:
Calculate the primorial up to the nthprime, 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 sequence of prime powers:
It is conjectured that for any integer , there is a prime
with
:
Verify this for a range of integers:
Plot Andrica's conjecture, which states that √pn+1-√pn<1 for every pair of consecutive prime numbers pn and pn+1:
Plot Brocard's conjecture, which states that if pn and pn+1 are consecutive primes greater than 2, then between (pn)2 and (pn+1)2 there are at least four prime numbers:
Plot polynomials for -gons, i.e. Chebyshev polynomials of the second kind, such that
is prime:
Special Sequences (12)
Find twin primes, i.e. pairs of primes of the form :
A prime is a Sophie Germain prime if
is also a prime:
There are 5 Fermat primes, i.e. Fermat numbers such that
is prime:
There are two Wieferich primes under , i.e. a prime number
such that
divides
:
Construct prime Euclid numbers:
Pythagorean primes can be written as the sum of two squares, i.e. a prime number :
Ramanujan primes are the smallest number Rn such that π(x) - π(x/2) ≥ n for all x≥ Rn:
Differences in nth Ramanujan primes and Prime:
Primes of the form , i.e. prime elements of the Gaussian integers:
Array plot of the Gaussian primes, a Gaussian integer such that if
and
are nonzero, then
is prime or if
,
or if
,
:
Emirp primes are primes whose reversal is also prime but not a palindrome:
Find home primes of .
is found by concatenating the prime factors of
and repeating until a prime is reached:
Properties & Relations (8)
The traditional mathematical notation for Prime:
Primes represents the domain of all prime numbers:
The largest domain of definitions of Prime:
Prime is asymptotically equivalent to as
:
PrimePi is the inverse of Prime:
Use NextPrime to find the next prime above n:
PrimeOmega counts the number of prime divisors:
EulerPhi[n] counts numbers less than or equal to that are coprime to
:
Neat Examples (6)
Ulam spiral colored based on the difference in Prime values:
Visualize when is divisible by primes. Each row of dots corresponds to the divisors of
, which are labelled along the horizontal axis:
Generate a path based on the Prime sequence:
Construct polyhedra using directed graphs generated by primes less than :
Text
Wolfram Research (1988), Prime, Wolfram Language function, https://reference.wolfram.com/language/ref/Prime.html (updated 2020).
CMS
Wolfram Language. 1988. "Prime." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/Prime.html.
APA
Wolfram Language. (1988). Prime. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Prime.html