# Prime number

"Prime" redirects here. Prime number_sentence_0

For other uses, see Prime (disambiguation). Prime number_sentence_1

A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. Prime number_sentence_2

A natural number greater than 1 that is not prime is called a composite number. Prime number_sentence_3

For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 × 1, involve 5 itself. Prime number_sentence_4

However, 4 is composite because it is a product (2 × 2) in which both numbers are smaller than 4. Prime number_sentence_5

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. Prime number_sentence_6

There are infinitely many primes, as demonstrated by Euclid around 300 BC. Prime number_sentence_7

No known simple formula separates prime numbers from composite numbers. Prime number_sentence_8

However, the distribution of primes within the natural numbers in the large can be statistically modelled. Prime number_sentence_9

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. Prime number_sentence_10

Several historical questions regarding prime numbers are still unsolved. Prime number_sentence_11

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. Prime number_sentence_12

Such questions spurred the development of various branches of number theory, focusing on analytic or algebraic aspects of numbers. Prime number_sentence_13

Primes are used in several routines in information technology, such as public-key cryptography, which relies on the difficulty of factoring large numbers into their prime factors. Prime number_sentence_14

In abstract algebra, objects that behave in a generalized way like prime numbers include prime elements and prime ideals. Prime number_sentence_15

## Definition and examples Prime number_section_0

Main article: List of prime numbers Prime number_sentence_16

The first 25 prime numbers (all the prime numbers less than 100) are: Prime number_sentence_17

Prime number_description_list_0

## History Prime number_section_1

The Rhind Mathematical Papyrus, from around 1550 BC, has Egyptian fraction expansions of different forms for prime and composite numbers. Prime number_sentence_18

However, the earliest surviving records of the explicit study of prime numbers come from ancient Greek mathematics. Prime number_sentence_19

Euclid's Elements (c. 300 BC) proves the infinitude of primes and the fundamental theorem of arithmetic, and shows how to construct a perfect number from a Mersenne prime. Prime number_sentence_20

Another Greek invention, the Sieve of Eratosthenes, is still used to construct lists of primes. Prime number_sentence_21

Many mathematicians have worked on primality tests for numbers larger than those where trial division is practicably applicable. Prime number_sentence_22

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. Prime number_sentence_23

Since 1951 all the largest known primes have been found using these tests on computers. Prime number_sentence_24

The search for ever larger primes has generated interest outside mathematical circles, through the Great Internet Mersenne Prime Search and other distributed computing projects. Prime number_sentence_25

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. Prime number_sentence_26

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. Prime number_sentence_27

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. Prime number_sentence_28

### Primality of one Prime number_section_2

Most early Greeks did not even consider 1 to be a number, so they could not consider its primality. Prime number_sentence_29

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. Prime number_sentence_30

However, Euclid and a majority of the other Greek mathematicians considered 2 as prime. Prime number_sentence_31

The medieval Islamic mathematicians largely followed the Greeks in viewing 1 as not being a number. Prime number_sentence_32

By the Middle Ages and Renaissance mathematicians began treating 1 as a number, and some of them included it as the first prime number. Prime number_sentence_33

In the mid-18th century Christian Goldbach listed 1 as prime in his correspondence with Leonhard Euler; however, Euler himself did not consider 1 to be prime. Prime number_sentence_34

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. Prime number_sentence_35

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. Prime number_sentence_36

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. Prime number_sentence_37

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. Prime number_sentence_38

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. Prime number_sentence_39

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". Prime number_sentence_40

## Elementary properties Prime number_section_3

### Unique factorization Prime number_section_4

Main article: Fundamental theorem of arithmetic Prime number_sentence_41

Writing a number as a product of prime numbers is called a prime factorization of the number. Prime number_sentence_42

For example: Prime number_sentence_43

The central importance of prime numbers to number theory and mathematics in general stems from the fundamental theorem of arithmetic. Prime number_sentence_44

This theorem states that every integer larger than 1 can be written as a product of one or more primes. Prime number_sentence_45

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. Prime number_sentence_46

So, although there are many different ways of finding a factorization using an integer factorization algorithm, they all must produce the same result. Prime number_sentence_47

Primes can thus be considered the "basic building blocks" of the natural numbers. Prime number_sentence_48

### Infinitude Prime number_section_5

Main article: Euclid's theorem Prime number_sentence_49

There are infinitely many prime numbers. Prime number_sentence_50

Another way of saying this is that the sequence Prime number_sentence_51

Prime number_description_list_1

• 2, 3, 5, 7, 11, 13, ...Prime number_item_1_1

of prime numbers never ends. Prime number_sentence_52

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. Prime number_sentence_53

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. Prime number_sentence_54

The numbers formed by adding one to the products of the smallest primes are called Euclid numbers. Prime number_sentence_55

The first five of them are prime, but the sixth, Prime number_sentence_56

is a composite number. Prime number_sentence_57

### Formulas for primes Prime number_section_6

Main article: Formula for primes Prime number_sentence_58

There is no known efficient formula for primes. Prime number_sentence_59

For example, there is no non-constant polynomial, even in several variables, that takes only prime values. Prime number_sentence_60

However, there are numerous expressions that do encode all primes, or only primes. Prime number_sentence_61

One possible formula is based on Wilson's theorem and generates the number 2 many times and all other primes exactly once. Prime number_sentence_62

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. Prime number_sentence_63

This can be used to obtain a single formula with the property that all its positive values are prime. Prime number_sentence_64

### Open questions Prime number_section_7

Further information: :Category:Conjectures about prime numbers Prime number_sentence_65

## Analytic properties Prime number_section_8

Analytic number theory studies number theory through the lens of continuous functions, limits, infinite series, and the related mathematics of the infinite and infinitesimal. Prime number_sentence_66

### Analytical proof of Euclid's theorem Prime number_section_9

Euler's proof that there are infinitely many primes considers the sums of reciprocals of primes, Prime number_sentence_67

is finite. Prime number_sentence_68

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. Prime number_sentence_69

### Number of primes below a given bound Prime number_section_10

Main articles: Prime number theorem and Prime-counting function Prime number_sentence_70

### Arithmetic progressions Prime number_section_11

An arithmetic progression is a finite or infinite sequence of numbers such that consecutive numbers in the sequence all have the same difference. Prime number_sentence_71

This difference is called the modulus of the progression. Prime number_sentence_72

For example, Prime number_sentence_73

Prime number_description_list_2

• 3, 12, 21, 30, 39, ...,Prime number_item_2_2

is an infinite arithmetic progression with modulus 9. Prime number_sentence_74

In an arithmetic progression, all the numbers have the same remainder when divided by the modulus; in this example, the remainder is 3. Prime number_sentence_75

Because both the modulus 9 and the remainder 3 are multiples of 3, so is every element in the sequence. Prime number_sentence_76

Therefore, this progression contains only one prime number, 3 itself. Prime number_sentence_77

In general, the infinite progression Prime number_sentence_78

The Green–Tao theorem shows that there are arbitrarily long finite arithmetic progressions consisting only of primes. Prime number_sentence_79

### Prime values of quadratic polynomials Prime number_section_12

Euler noted that the function Prime number_sentence_80

The Ulam spiral arranges the natural numbers in a two-dimensional grid, spiraling in concentric squares surrounding the origin with the prime numbers highlighted. Prime number_sentence_81

Visually, the primes appear to cluster on certain diagonals and not others, suggesting that some quadratic polynomials take prime values more often than others. Prime number_sentence_82

### Zeta function and the Riemann hypothesis Prime number_section_13

Main article: Riemann hypothesis Prime number_sentence_83

## Abstract algebra Prime number_section_14

### Modular arithmetic and finite fields Prime number_section_15

Main article: Modular arithmetic Prime number_sentence_84

Main article: p-adic number Prime number_sentence_85

### Prime elements in rings Prime number_section_17

Main articles: Prime element and Irreducible element Prime number_sentence_86

In an arbitrary ring, all prime elements are irreducible. Prime number_sentence_87

The converse does not hold in general, but does hold for unique factorization domains. Prime number_sentence_88

### Prime ideals Prime number_section_18

Main article: Prime ideals Prime number_sentence_89

The spectrum of a ring is a geometric space whose points are the prime ideals of the ring. Prime number_sentence_90

Arithmetic geometry also benefits from this notion, and many concepts exist in both geometry and number theory. Prime number_sentence_91

For example, factorization or ramification of prime ideals when lifted to an extension field, a basic problem of algebraic number theory, bears some resemblance with ramification in geometry. Prime number_sentence_92

These concepts can even assist with in number-theoretic questions solely concerned with integers. Prime number_sentence_93

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. Prime number_sentence_94

Early attempts to prove Fermat's Last Theorem led to Kummer's introduction of regular primes, integer prime numbers connected with the failure of unique factorization in the cyclotomic integers. Prime number_sentence_95

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. Prime number_sentence_96

## Computational methods Prime number_section_20

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. Prime number_sentence_97

In particular, number theorists such as British mathematician G. Prime number_sentence_98 H. Hardy prided themselves on doing work that had absolutely no military significance. Prime number_sentence_99

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. Prime number_sentence_100

These applications have led to significant study of algorithms for computing with prime numbers, and in particular of primality testing, methods for determining whether a given number is prime. Prime number_sentence_101

The most basic primality testing routine, trial division, is too slow to be useful for large numbers. Prime number_sentence_102

One group of modern primality tests is applicable to arbitrary numbers, while more efficient tests are available for numbers of special types. Prime number_sentence_103

Most primality tests only tell whether their argument is prime or not. Prime number_sentence_104

Routines that also provide a prime factor of composite arguments (or all of its prime factors) are called factorization algorithms. Prime number_sentence_105

Prime numbers are also used in computing for checksums, hash tables, and pseudorandom number generators. Prime number_sentence_106

### Trial division Prime number_section_21

Main article: Trial division Prime number_sentence_107

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. Prime number_sentence_108

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. Prime number_sentence_109

### Sieves Prime number_section_22

Main article: Sieve of Eratosthenes Prime number_sentence_110

Before computers, mathematical tables listing all of the primes or prime factorizations up to a given limit were commonly printed. Prime number_sentence_111

The oldest method for generating a list of primes is called the sieve of Eratosthenes. Prime number_sentence_112

The animation shows an optimized variant of this method. Prime number_sentence_113

Another more asymptotically efficient sieving method for the same problem is the sieve of Atkin. Prime number_sentence_114

In advanced mathematics, sieve theory applies similar methods to other problems. Prime number_sentence_115

### Primality testing versus primality proving Prime number_section_23

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. Prime number_sentence_116

For instance, this is true of trial division. Prime number_sentence_117

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. Prime number_sentence_118

When the elliptic curve method concludes that a number is prime, it provides primality certificate that can be verified quickly. Prime number_sentence_119

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. Prime number_sentence_120

The AKS primality test has mathematically proven time complexity, but is slower than elliptic curve primality proving in practice. Prime number_sentence_121

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. Prime number_sentence_122

### Special-purpose algorithms and the largest known prime Prime number_section_24

Further information: List of prime numbers Prime number_sentence_123

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. Prime number_sentence_124

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. Prime number_sentence_125

This is why since 1992 (as of December 2018) the largest known prime has always been a Mersenne prime. Prime number_sentence_126

It is conjectured that there are infinitely many Mersenne primes. Prime number_sentence_127

The following table gives the largest known primes of various types. Prime number_sentence_128

Some of these primes have been found using distributed computing. Prime number_sentence_129

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. Prime number_sentence_130

The Electronic Frontier Foundation also offers \$150,000 and \$250,000 for primes with at least 100 million digits and 1 billion digits, respectively. Prime number_sentence_131

Prime number_table_general_0

Mersenne primePrime number_cell_0_1_0 2 − 1Prime number_cell_0_1_1 24,862,048Prime number_cell_0_1_2 December 7, 2018Prime number_cell_0_1_3 Patrick Laroche, Great Internet Mersenne Prime SearchPrime number_cell_0_1_4
Proth primePrime number_cell_0_2_0 10,223 × 2 + 1Prime number_cell_0_2_1 9,383,761Prime number_cell_0_2_2 October 31, 2016Prime number_cell_0_2_3 Péter Szabolcs, PrimeGridPrime number_cell_0_2_4
factorial primePrime number_cell_0_3_0 208,003! − 1Prime number_cell_0_3_1 1,015,843Prime number_cell_0_3_2 July 2016Prime number_cell_0_3_3 Sou FukuiPrime number_cell_0_3_4
primorial primePrime number_cell_0_4_0 1,098,133# − 1Prime number_cell_0_4_1 476,311Prime number_cell_0_4_2 March 2012Prime number_cell_0_4_3 James P. Burt, PrimeGridPrime number_cell_0_4_4
twin primesPrime number_cell_0_5_0 2,996,863,034,895  × 2 ± 1Prime number_cell_0_5_1 388,342Prime number_cell_0_5_2 September 2016Prime number_cell_0_5_3 Tom Greer, PrimeGridPrime number_cell_0_5_4

### Integer factorization Prime number_section_25

Main article: Integer factorization Prime number_sentence_132

Shor's algorithm can factor any integer in a polynomial number of steps on a quantum computer. Prime number_sentence_133

However, current technology can only run this algorithm for very small numbers. Prime number_sentence_134

As of October 2012 the largest number that has been factored by a quantum computer running Shor's algorithm is 21. Prime number_sentence_135

## Other applications Prime number_section_27

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. Prime number_sentence_136

For example, it is possible to place prime numbers of points in a two-dimensional grid so that no three are in a line, or so that every triangle formed by three of the points has large area. Prime number_sentence_137

Another example is Eisenstein's criterion, a test for whether a polynomial is irreducible based on divisibility of its coefficients by a prime number and its square. Prime number_sentence_138

The concept of prime number is so important that it has been generalized in different ways in various branches of mathematics. Prime number_sentence_139

Generally, "prime" indicates minimality or indecomposability, in an appropriate sense. Prime number_sentence_140

For example, the prime field of a given field is its smallest subfield that contains both 0 and 1. Prime number_sentence_141

It is either the field of rational numbers or a finite field with a prime number of elements, whence the name. Prime number_sentence_142

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. Prime number_sentence_143

For example, in knot theory, a prime knot is a knot that is indecomposable in the sense that it cannot be written as the connected sum of two nontrivial knots. Prime number_sentence_144

Any knot can be uniquely expressed as a connected sum of prime knots. Prime number_sentence_145

The prime decomposition of 3-manifolds is another example of this type. Prime number_sentence_146

Beyond mathematics and computing, prime numbers have potential connections to quantum mechanics, and have been used metaphorically in the arts and literature. Prime number_sentence_147

They have also been used in evolutionary biology to explain the life cycles of cicadas. Prime number_sentence_148

### Constructible polygons and polygon partitions Prime number_section_28

Fermat primes are primes of the form Prime number_sentence_149

### Quantum mechanics Prime number_section_29

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 number_sentence_150

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. Prime number_sentence_151

### Biology Prime number_section_30

The evolutionary strategy used by cicadas of the genus Magicicada makes use of prime numbers. Prime number_sentence_152

These insects spend most of their lives as grubs underground. Prime number_sentence_153

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. Prime number_sentence_154

Biologists theorize that these prime-numbered breeding cycle lengths have evolved in order to prevent predators from synchronizing with these cycles. Prime number_sentence_155

In contrast, the multi-year periods between flowering in bamboo plants are hypothesized to be smooth numbers, having only small prime numbers in their factorizations. Prime number_sentence_156

### Arts and literature Prime number_section_31

Prime numbers have influenced many artists and writers. Prime number_sentence_157

The French composer Olivier Messiaen used prime numbers to create ametrical music through "natural phenomena". Prime number_sentence_158

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". Prime number_sentence_159

According to Messiaen this way of composing was "inspired by the movements of nature, movements of free and unequal durations". Prime number_sentence_160

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. Prime number_sentence_161

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. Prime number_sentence_162

Prime numbers are used as a metaphor for loneliness and isolation in the Paolo Giordano novel The Solitude of Prime Numbers, in which they are portrayed as "outsiders" among integers. Prime number_sentence_163