"Prime" redirects here.
For other uses, see Prime (disambiguation).
A natural number greater than 1 that is not prime is called a composite number.
For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 × 1, involve 5 itself.
However, 4 is composite because it is a product (2 × 2) in which both numbers are smaller than 4.
Primes are central in number theory because of the fundamental theorem of arithmetic: every natural number greater than 1 is either a prime itself or can be factorized as a product of primes that is unique up to their order.
No known simple formula separates prime numbers from composite numbers.
However, the distribution of primes within the natural numbers in the large can be statistically modelled.
The first result in that direction is the prime number theorem, proven at the end of the 19th century, which says that the probability of a randomly chosen number being prime is inversely proportional to its number of digits, that is, to its logarithm.
Several historical questions regarding prime numbers are still unsolved.
These include Goldbach's conjecture, that every even integer greater than 2 can be expressed as the sum of two primes, and the twin prime conjecture, that there are infinitely many pairs of primes having just one even number between them.
Definition and examples
Main article: List of prime numbers
The first 25 prime numbers (all the prime numbers less than 100) are:
- 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 (sequence in the OEIS).
However, the earliest surviving records of the explicit study of prime numbers come from ancient Greek mathematics.
Another Greek invention, the Sieve of Eratosthenes, is still used to construct lists of primes.
Many mathematicians have worked on primality tests for numbers larger than those where trial division is practicably applicable.
Methods that are restricted to specific number forms include Pépin's test for Fermat numbers (1877), Proth's theorem (c. 1878), the Lucas–Lehmer primality test (originated 1856), and the generalized Lucas primality test.
The idea that prime numbers had few applications outside of pure mathematics was shattered in the 1970s when public-key cryptography and the RSA cryptosystem were invented, using prime numbers as their basis.
The increased practical importance of computerized primality testing and factorization led to the development of improved methods capable of handling large numbers of unrestricted form.
The mathematical theory of prime numbers also moved forward with the Green–Tao theorem (2004) that there are arbitrarily long arithmetic progressions of prime numbers, and Yitang Zhang's 2013 proof that there exist infinitely many prime gaps of bounded size.
Primality of one
Most early Greeks did not even consider 1 to be a number, so they could not consider its primality.
A few mathematicians from this time also considered the prime numbers to be a subdivision of the odd numbers, so they also did not consider 2 to be prime.
However, Euclid and a majority of the other Greek mathematicians considered 2 as prime.
The medieval Islamic mathematicians largely followed the Greeks in viewing 1 as not being a number.
By the Middle Ages and Renaissance mathematicians began treating 1 as a number, and some of them included it as the first prime number.
In the 19th century many mathematicians still considered 1 to be prime, and lists of primes that included 1 continued to be published as recently as 1956.
If the definition of a prime number were changed to call 1 a prime, many statements involving prime numbers would need to be reworded in a more awkward way.
For example, the fundamental theorem of arithmetic would need to be rephrased in terms of factorizations into primes greater than 1, because every number would have multiple factorizations with different numbers of copies of 1.
Similarly, the sieve of Eratosthenes would not work correctly if it handled 1 as a prime, because it would eliminate all multiples of 1 (that is, all other numbers) and output only the single number 1.
Some other more technical properties of prime numbers also do not hold for the number 1: for instance, the formulas for Euler's totient function or for the sum of divisors function are different for prime numbers than they are for 1.
By the early 20th century, mathematicians began to agree that 1 should not be listed as prime, but rather in its own special category as a "unit".
Main article: Fundamental theorem of arithmetic
Writing a number as a product of prime numbers is called a prime factorization of the number.
The central importance of prime numbers to number theory and mathematics in general stems from the fundamental theorem of arithmetic.
This theorem states that every integer larger than 1 can be written as a product of one or more primes.
More strongly, this product is unique in the sense that any two prime factorizations of the same number will have the same numbers of copies of the same primes, although their ordering may differ.
So, although there are many different ways of finding a factorization using an integer factorization algorithm, they all must produce the same result.
Primes can thus be considered the "basic building blocks" of the natural numbers.
Main article: Euclid's theorem
There are infinitely many prime numbers.
Another way of saying this is that the sequence
- 2, 3, 5, 7, 11, 13, ...
of prime numbers never ends.
This statement is referred to as Euclid's theorem in honor of the ancient Greek mathematician Euclid, since the first known proof for this statement is attributed to him.
Many more proofs of the infinitude of primes are known, including an analytical proof by Euler, Goldbach's proof based on Fermat numbers, Furstenberg's proof using general topology, and Kummer's elegant proof.
The numbers formed by adding one to the products of the smallest primes are called Euclid numbers.
The first five of them are prime, but the sixth,
is a composite number.
Formulas for primes
Main article: Formula for primes
There is no known efficient formula for primes.
For example, there is no non-constant polynomial, even in several variables, that takes only prime values.
However, there are numerous expressions that do encode all primes, or only primes.
One possible formula is based on Wilson's theorem and generates the number 2 many times and all other primes exactly once.
There is also a set of Diophantine equations in nine variables and one parameter with the following property: the parameter is prime if and only if the resulting system of equations has a solution over the natural numbers.
This can be used to obtain a single formula with the property that all its positive values are prime.
Further information: :Category:Conjectures about prime numbers
Analytical proof of Euclid's theorem
Euler's proof that there are infinitely many primes considers the sums of reciprocals of primes,
Because of Brun's theorem, it is not possible to use Euler's method to solve the twin prime conjecture, that there exist infinitely many twin primes.
Number of primes below a given bound
An arithmetic progression is a finite or infinite sequence of numbers such that consecutive numbers in the sequence all have the same difference.
This difference is called the modulus of the progression.
- 3, 12, 21, 30, 39, ...,
is an infinite arithmetic progression with modulus 9.
In an arithmetic progression, all the numbers have the same remainder when divided by the modulus; in this example, the remainder is 3.
Because both the modulus 9 and the remainder 3 are multiples of 3, so is every element in the sequence.
Therefore, this progression contains only one prime number, 3 itself.
In general, the infinite progression
The Green–Tao theorem shows that there are arbitrarily long finite arithmetic progressions consisting only of primes.
Prime values of quadratic polynomials
Euler noted that the function
The Ulam spiral arranges the natural numbers in a two-dimensional grid, spiraling in concentric squares surrounding the origin with the prime numbers highlighted.
Visually, the primes appear to cluster on certain diagonals and not others, suggesting that some quadratic polynomials take prime values more often than others.
Zeta function and the Riemann hypothesis
Main article: Riemann hypothesis
Modular arithmetic and finite fields
Main article: Modular arithmetic
Main article: p-adic number
Prime elements in rings
In an arbitrary ring, all prime elements are irreducible.
The converse does not hold in general, but does hold for unique factorization domains.
Main article: Prime ideals
The spectrum of a ring is a geometric space whose points are the prime ideals of the ring.
Arithmetic geometry also benefits from this notion, and many concepts exist in both geometry and number theory.
These concepts can even assist with in number-theoretic questions solely concerned with integers.
For example, prime ideals in the ring of integers of quadratic number fields can be used in proving quadratic reciprocity, a statement that concerns the existence of square roots modulo integer prime numbers.
The question of how many integer prime numbers factor into a product of multiple prime ideals in an algebraic number field is addressed by Chebotarev's density theorem, which (when applied to the cyclotomic integers) has Dirichlet's theorem on primes in arithmetic progressions as a special case.
For a long time, number theory in general, and the study of prime numbers in particular, was seen as the canonical example of pure mathematics, with no applications outside of mathematics other than the use of prime numbered gear teeth to distribute wear evenly.
This vision of the purity of number theory was shattered in the 1970s, when it was publicly announced that prime numbers could be used as the basis for the creation of public key cryptography algorithms.
The most basic primality testing routine, trial division, is too slow to be useful for large numbers.
One group of modern primality tests is applicable to arbitrary numbers, while more efficient tests are available for numbers of special types.
Most primality tests only tell whether their argument is prime or not.
Routines that also provide a prime factor of composite arguments (or all of its prime factors) are called factorization algorithms.
Main article: Trial division
Although this method is simple to describe, it is impractical for testing the primality of large integers, because the number of tests that it performs grows exponentially as a function of the number of digits of these integers.
However, trial division is still used, with a smaller limit than the square root on the divisor size, to quickly discover composite numbers with small factors, before using more complicated methods on the numbers that pass this filter.
Main article: Sieve of Eratosthenes
Before computers, mathematical tables listing all of the primes or prime factorizations up to a given limit were commonly printed.
The oldest method for generating a list of primes is called the sieve of Eratosthenes.
The animation shows an optimized variant of this method.
Another more asymptotically efficient sieving method for the same problem is the sieve of Atkin.
In advanced mathematics, sieve theory applies similar methods to other problems.
Primality testing versus primality proving
In contrast, some other algorithms guarantee that their answer will always be correct: primes will always be determined to be prime and composites will always be determined to be composite.
For instance, this is true of trial division.
The algorithms with guaranteed-correct output include both deterministic (non-random) algorithms, such as the AKS primality test, and randomized Las Vegas algorithms where the random choices made by the algorithm do not affect its final answer, such as some variations of elliptic curve primality proving.
When the elliptic curve method concludes that a number is prime, it provides primality certificate that can be verified quickly.
The elliptic curve primality test is the fastest in practice of the guaranteed-correct primality tests, but its runtime analysis is based on heuristic arguments rather than rigorous proofs.
The AKS primality test has mathematically proven time complexity, but is slower than elliptic curve primality proving in practice.
These methods can be used to generate large random prime numbers, by generating and testing random numbers until finding one that is prime; when doing this, a faster probabilistic test can quickly eliminate most composite numbers before a guaranteed-correct algorithm is used to verify that the remaining numbers are prime.
Special-purpose algorithms and the largest known prime
Further information: List of prime numbers
In addition to the aforementioned tests that apply to any natural number, some numbers of a special form can be tested for primality more quickly.
For example, the Lucas–Lehmer primality test can determine whether a Mersenne number (one less than a power of two) is prime, deterministically, in the same time as a single iteration of the Miller–Rabin test.
This is why since 1992 (as of December 2018) the largest known prime has always been a Mersenne prime.
It is conjectured that there are infinitely many Mersenne primes.
The following table gives the largest known primes of various types.
Some of these primes have been found using distributed computing.
In 2009, the Great Internet Mersenne Prime Search project was awarded a US$100,000 prize for first discovering a prime with at least 10 million digits.
The Electronic Frontier Foundation also offers $150,000 and $250,000 for primes with at least 100 million digits and 1 billion digits, respectively.
|Type||Prime||Number of decimal digits||Date||Found by|
|Mersenne prime||2 − 1||24,862,048||December 7, 2018||Patrick Laroche, Great Internet Mersenne Prime Search|
|Proth prime||10,223 × 2 + 1||9,383,761||October 31, 2016||Péter Szabolcs, PrimeGrid|
|factorial prime||208,003! − 1||1,015,843||July 2016||Sou Fukui|
|primorial prime||1,098,133# − 1||476,311||March 2012||James P. Burt, PrimeGrid|
|twin primes||2,996,863,034,895 × 2 ± 1||388,342||September 2016||Tom Greer, PrimeGrid|
Main article: Integer factorization
However, current technology can only run this algorithm for very small numbers.
As of October 2012 the largest number that has been factored by a quantum computer running Shor's algorithm is 21.
Other computational applications
Prime numbers are of central importance to number theory but also have many applications to other areas within mathematics, including abstract algebra and elementary geometry.
The concept of prime number is so important that it has been generalized in different ways in various branches of mathematics.
Generally, "prime" indicates minimality or indecomposability, in an appropriate sense.
For example, the prime field of a given field is its smallest subfield that contains both 0 and 1.
It is either the field of rational numbers or a finite field with a prime number of elements, whence the name.
Often a second, additional meaning is intended by using the word prime, namely that any object can be, essentially uniquely, decomposed into its prime components.
Any knot can be uniquely expressed as a connected sum of prime knots.
The prime decomposition of 3-manifolds is another example of this type.
Beyond mathematics and computing, prime numbers have potential connections to quantum mechanics, and have been used metaphorically in the arts and literature.
Constructible polygons and polygon partitions
Fermat primes are primes of the form
Beginning with the work of Hugh Montgomery and Freeman Dyson in the 1970s, mathematicians and physicists have speculated that the zeros of the Riemann zeta function are connected to the energy levels of quantum systems.
Prime numbers are also significant in quantum information science, thanks to mathematical structures such as mutually unbiased bases and symmetric informationally complete positive-operator-valued measures.
These insects spend most of their lives as grubs underground.
They only pupate and then emerge from their burrows after 7, 13 or 17 years, at which point they fly about, breed, and then die after a few weeks at most.
Biologists theorize that these prime-numbered breeding cycle lengths have evolved in order to prevent predators from synchronizing with these cycles.
Arts and literature
Prime numbers have influenced many artists and writers.
In works such as La Nativité du Seigneur (1935) and Quatre études de rythme (1949–50), he simultaneously employs motifs with lengths given by different prime numbers to create unpredictable rhythms: the primes 41, 43, 47 and 53 appear in the third étude, "Neumes rythmiques".
According to Messiaen this way of composing was "inspired by the movements of nature, movements of free and unequal durations".
In his science fiction novel Contact, scientist Carl Sagan suggested that prime factorization could be used as a means of establishing two-dimensional image planes in communications with aliens, an idea that he had first developed informally with American astronomer Frank Drake in 1975.
In the novel The Curious Incident of the Dog in the Night-Time by Mark Haddon, the narrator arranges the sections of the story by consecutive prime numbers as a way to convey the mental state of its main character, a mathematically gifted teen with Asperger syndrome.
Credits to the contents of this page go to the authors of the corresponding Wikipedia page: en.wikipedia.org/wiki/Prime number.