:Prime number
{{Short description|Number divisible only by 1 or itself}}
{{Redirect|Prime}}
{{Pp-vandalism|small=yes}}
{{Good article}}
File:Primes-vs-composites.svgs can be arranged into rectangles but prime numbers cannot.|alt=Groups of two to twelve dots, showing that the composite numbers of dots (4, 6, 8, 9, 10, and 12) can be arranged into rectangles but prime numbers cannot]]
A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. 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, {{nowrap|1 × 5}} or {{nowrap|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.
The property of being prime is called primality. A simple but slow method of checking the primality of a given number {{tmath|n}}, called trial division, tests whether {{tmath|n}} is a multiple of any integer between 2 and {{tmath|\sqrt{n} }}. Faster algorithms include the Miller–Rabin primality test, which is fast but has a small chance of error, and the AKS primality test, which always produces the correct answer in polynomial time but is too slow to be practical. Particularly fast methods are available for numbers of special forms, such as Mersenne numbers. {{As of|2024|10}} the largest known prime number is a Mersenne prime with 41,024,320 decimal digits.{{cite web |title=GIMPS Discovers Largest Known Prime Number: 2136,279,841 − 1 |url=https://www.mersenne.org/primes/?press=M136279841 |date=21 October 2024 |work=Mersenne Research, Inc. |access-date=21 October 2024}}{{Cite journal |last=Sparkes |first=Matthew |date=November 2, 2024 |title=Amateur sleuth finds largest-known prime number |journal=New Scientist |page=19}}
There are infinitely many primes, as demonstrated by Euclid around 300 BC. 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 roughly that the probability of a randomly chosen large 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 that differ by two. Such questions spurred the development of various branches of number theory, focusing on analytic or algebraic aspects of numbers. 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. In abstract algebra, objects that behave in a generalized way like prime numbers include prime elements and prime ideals.
Definition and examples
{{main|List of prime numbers}}
A natural number (1, 2, 3, 4, 5, 6, etc.) is called a prime number (or a prime) if it is greater than 1 and cannot be written as the product of two smaller natural numbers. The numbers greater than 1 that are not prime are called composite numbers.{{cite book|title=The Mathematical Olympiad Handbook: An Introduction to Problem Solving Based on the First 32 British Mathematical Olympiads 1965–1996|first=Anthony|last=Gardiner|author-link=Tony Gardiner|publisher=Oxford University Press|year=1997|isbn=978-0-19-850105-3|page=[https://archive.org/details/mathematicalolym1997gard/page/26 26]|url=https://archive.org/details/mathematicalolym1997gard|url-access=registration}} In other words, {{tmath|n}} is prime if {{tmath|n}} items cannot be divided up into smaller equal-size groups of more than one item,{{cite book|title=Dyslexia, Dyscalculia and Mathematics: A practical guide|first=Anne|last=Henderson|edition=2nd|publisher=Routledge|year=2014|isbn=978-1-136-63662-2|page=62|url=https://books.google.com/books?id=uy-yGVRUilMC&pg=PA62}} or if it is not possible to arrange {{tmath|n}} dots into a rectangular grid that is more than one dot wide and more than one dot high.{{cite book|title=The Giant Golden Book of Mathematics: Exploring the World of Numbers and Space|url=https://archive.org/details/giantgoldenbooko00adle|url-access=registration |first=Irving|last=Adler|author-link=Irving Adler|publisher=Golden Press|year=1960|page=[https://archive.org/details/giantgoldenbooko00adle/page/16 16]|oclc=6975809}} For example, among the numbers 1 through 6, the numbers 2, 3, and 5 are the prime numbers,{{cite book | url = https://archive.org/details/barronsmathworkb00leff_0 | url-access = registration | page = [https://archive.org/details/barronsmathworkb00leff_0/page/360 360] | title = Math Workbook for the SAT I | first = Lawrence S. | last = Leff | publisher = Barron's Educational Series | year = 2000 | isbn = 978-0-7641-0768-9}} as there are no other numbers that divide them evenly (without a remainder). 1 is not prime, as it is specifically excluded in the definition. {{nowrap|1=4 = 2 × 2}} and {{nowrap|1=6 = 2 × 3}} are both composite.
File:Prime number Cuisenaire rods 7.png, that 7 is prime, because none of 2, 3, 4, 5, or 6 divide it evenly|alt=refer to caption]]
The divisors of a natural number {{tmath|n}} are the natural numbers that divide {{tmath|n}} evenly. Every natural number has both 1 and itself as a divisor. If it has any other divisor, it cannot be prime. This leads to an equivalent definition of prime numbers: they are the numbers with exactly two positive divisors. Those two are 1 and the number itself. As 1 has only one divisor, itself, it is not prime by this definition.{{cite book | last1=Dudley | first1=Underwood | author-link=Underwood Dudley | title=Elementary number theory | publisher=W.H. Freeman and Co. | edition=2nd | isbn=978-0-7167-0076-0 | year=1978 | contribution=Section 2: Unique factorization | page=[https://archive.org/details/elementarynumber00dudl_0/page/10 10] | contribution-url=https://books.google.com/books?id=tr7SzBTsk1UC&pg=PA10 | url=https://archive.org/details/elementarynumber00dudl_0/page/10 }} Yet another way to express the same thing is that a number {{tmath|n}} is prime if it is greater than one and if none of the numbers divides {{tmath|n}} evenly.{{cite book | last = Sierpiński | first = Wacław | author-link = Wacław Sierpiński | title = Elementary Theory of Numbers | edition = 2nd | volume = 31 | series = North-Holland Mathematical Library | publisher = Elsevier | year = 1988 | isbn = 978-0-08-096019-7 | page = 113 | url = https://books.google.com/books?id=ktCZ2MvgN3MC&pg=PA113 }}
The first 25 prime numbers (all the prime numbers less than 100) are:{{cite journal | last = Ziegler | first = Günter M. | author-link = Günter M. Ziegler | issue = 4 | journal = Notices of the American Mathematical Society | mr = 2039814 | pages = 414–416 | title = The great prime number record races | volume = 51 | year = 2004}}
: 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 {{OEIS|id=A000040}}.
No even number {{tmath|n}} greater than 2 is prime because any such number can be expressed as the product {{tmath| 2\times n/2 }}. Therefore, every prime number other than 2 is an odd number, and is called an odd prime.{{cite book|title=Numbers and Geometry|series=Undergraduate Texts in Mathematics|first=John|last=Stillwell|author-link=John Stillwell|publisher=Springer|year=1997|isbn=978-0-387-98289-2|page=9|url=https://books.google.com/books?id=4elkHwVS0eUC&pg=PA9}} Similarly, when written in the usual decimal system, all prime numbers larger than 5 end in 1, 3, 7, or 9. The numbers that end with other digits are all composite: decimal numbers that end in 0, 2, 4, 6, or 8 are even, and decimal numbers that end in 0 or 5 are divisible by 5.{{cite book | last = Sierpiński | first = Wacław | author-link = Wacław Sierpiński | location = New York | mr = 0170843 | page = [https://archive.org/details/selectionproblem00sier/page/n37 40] | publisher = Macmillan | title = A Selection of Problems in the Theory of Numbers | url = https://archive.org/details/selectionproblem00sier | url-access = limited | year = 1964}}
The set of all primes is sometimes denoted by (a boldface capital P){{cite book|title=Elementary Methods in Number Theory|volume=195|series=Graduate Texts in Mathematics|contribution=Notations and Conventions|contribution-url=https://books.google.com/books?id=sE7lBwAAQBAJ&pg=PP10|first=Melvyn B.|last=Nathanson|author-link=Melvyn B. Nathanson|publisher=Springer|year=2000|isbn=978-0-387-22738-2|mr=1732941}} or by (a blackboard bold capital P).{{cite book|title=The Mathematics of Infinity: A Guide to Great Ideas|volume=111|series=Pure and Applied Mathematics: A Wiley Series of Texts, Monographs and Tracts|first=Theodore G.|last=Faticoni|edition=2nd|publisher=John Wiley & Sons|year=2012|isbn=978-1-118-24382-4|page=44|url=https://books.google.com/books?id=I433i_ZGxRsC&pg=PA44}}
History
File:Rhind Mathematical Papyrus.jpg|alt=The Rhind Mathematical Papyrus]]
The Rhind Mathematical Papyrus, from around 1550 BC, has Egyptian fraction expansions of different forms for prime and composite numbers.Bruins, Evert Marie, review in Mathematical Reviews of {{cite journal | last = Gillings | first = R.J. | doi = 10.1007/BF01307175 | journal = Archive for History of Exact Sciences | mr = 0497458 | pages = 291–298 | title = The recto of the Rhind Mathematical Papyrus. How did the ancient Egyptian scribe prepare it? | volume = 12 | issue = 4 | year = 1974| s2cid = 121046003 }} However, the earliest surviving records of the study of prime numbers come from the ancient Greek mathematicians, who called them {{Transliteration|grc|prōtos arithmòs}} ({{lang|grc|πρῶτος ἀριθμὸς}}). 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.{{cite book|title=Mathematics and Its History|series=Undergraduate Texts in Mathematics|first=John|last=Stillwell|author-link=John Stillwell |edition=3rd |publisher=Springer |year=2010 |isbn=978-1-4419-6052-8 |page=40 |url=https://books.google.com/books?id=V7mxZqjs5yUC&pg=PA40}} Another Greek invention, the Sieve of Eratosthenes, is still used to construct lists of {{nowrap|primes.{{cite journal |title=The Search for Prime Numbers|first=Carl|last=Pomerance|author-link=Carl Pomerance|journal=Scientific American|volume=247|issue=6|date=December 1982|pages=136–147|jstor=24966751|doi=10.1038/scientificamerican1282-136|bibcode=1982SciAm.247f.136P}}{{cite journal | last = Mollin | first = Richard A. | doi = 10.2307/3219180 | issue = 1 | journal = Mathematics Magazine | mr = 2107288 | pages = 18–29 | title = A brief history of factoring and primality testing B. C. (before computers) | volume = 75 | year = 2002| jstor = 3219180 }}}}
Around 1000 AD, the Islamic mathematician Ibn al-Haytham (Alhazen) found Wilson's theorem, characterizing the prime numbers as the numbers {{tmath|n}} that evenly divide {{tmath|(n-1)!+1}}. He also conjectured that all even perfect numbers come from Euclid's construction using Mersenne primes, but was unable to prove it.{{MacTutor Biography|id=Al-Haytham|title=Abu Ali al-Hasan ibn al-Haytham|mode=cs1}} Another Islamic mathematician, Ibn al-Banna' al-Marrakushi, observed that the sieve of Eratosthenes can be sped up by considering only the prime divisors up to the square root of the upper limit. Fibonacci took the innovations from Islamic mathematics to Europe. His book Liber Abaci (1202) was the first to describe trial division for testing primality, again using divisors only up to the square root.
In 1640 Pierre de Fermat stated (without proof) Fermat's little theorem (later proved by Leibniz and Euler).{{harvnb|Sandifer|2007}}, [https://books.google.com/books?id=sohHs7ExOsYC&pg=PA45 8. Fermat's Little Theorem (November 2003), p. 45] Fermat also investigated the primality of the Fermat numbers {{tmath|2^{2^n}+1}},{{cite book|title=How Euler Did Even More|first=C. Edward|last=Sandifer|publisher=Mathematical Association of America|year=2014|isbn=978-0-88385-584-3|page=42|url=https://books.google.com/books?id=3c6iBQAAQBAJ&pg=PA42}} and Marin Mersenne studied the Mersenne primes, prime numbers of the form with {{tmath|p}} itself a prime.{{cite book|title=Elementary Number Theory with Applications|first=Thomas|last=Koshy|publisher=Academic Press|year=2002|isbn=978-0-12-421171-1|page=369|url=https://books.google.com/books?id=-9pg-4Pa19IC&pg=PA369}} Christian Goldbach formulated Goldbach's conjecture, that every even number is the sum of two primes, in a 1742 letter to Euler.{{cite book|title=Goldbach Conjecture|edition=2nd|volume=4|series=Series In Pure Mathematics|first=Wang|last=Yuan|publisher=World Scientific|year=2002|isbn=978-981-4487-52-8|page=21|url=https://books.google.com/books?id=g4jVCgAAQBAJ&pg=PA21}} Euler proved Alhazen's conjecture (now the Euclid–Euler theorem) that all even perfect numbers can be constructed from Mersenne primes. He introduced methods from mathematical analysis to this area in his proofs of the infinitude of the primes and the divergence of the sum of the reciprocals of the primes {{tmath|\tfrac{1}{2}+\tfrac{1}{3}+\tfrac{1}{5}+\tfrac{1}{7}+\tfrac{1}{11}+\cdots}}.{{cite book|title=The Development of Prime Number Theory: From Euclid to Hardy and Littlewood|series=Springer Monographs in Mathematics|first=Wladyslaw|last=Narkiewicz|publisher=Springer|year=2000|isbn=978-3-540-66289-1|page=11|contribution=1.2 Sum of Reciprocals of Primes|contribution-url=https://books.google.com/books?id=VVr3EuiHU0YC&pg=PA11}} At the start of the 19th century, Legendre and Gauss conjectured that as {{tmath|x}} tends to infinity, the number of primes up to {{tmath|x}} is asymptotic to {{tmath| x/\log x }}, where is the natural logarithm of {{tmath|x}}. A weaker consequence of this high density of primes was Bertrand's postulate, that for every there is a prime between {{tmath|n}} and {{tmath|2n}}, proved in 1852 by Pafnuty Chebyshev.{{cite journal|first=P. |last=Tchebychev |author-link=Pafnuty Chebyshev |title=Mémoire sur les nombres premiers. |journal=Journal de mathématiques pures et appliquées |series=Série 1 |year=1852 |pages=366–390 |url=http://sites.mathdoc.fr/JMPA/PDF/JMPA_1852_1_17_A19_0.pdf |language=fr}}. (Proof of the postulate: 371–382). Also see Mémoires de l'Académie Impériale des Sciences de St. Pétersbourg, vol. 7, pp. 15–33, 1854 Ideas of Bernhard Riemann in his 1859 paper on the zeta-function sketched an outline for proving the conjecture of Legendre and Gauss. Although the closely related Riemann hypothesis remains unproven, Riemann's outline was completed in 1896 by Hadamard and de la Vallée Poussin, and the result is now known as the prime number theorem.{{cite book | last = Apostol | first = Tom M. | author-link = Tom M. Apostol | editor1-last = Bambah | editor1-first = R.P. | editor2-last = Dumir | editor2-first = V.C. | editor3-last = Hans-Gill | editor3-first = R.J. | contribution = A centennial history of the prime number theorem | location = Basel | mr = 1764793 | pages = 1–14 | publisher = Birkhäuser | series = Trends in Mathematics | title = Number Theory | contribution-url = https://books.google.com/books?id=aiDyBwAAQBAJ&pg=PA1 | year = 2000}} Another important 19th century result was Dirichlet's theorem on arithmetic progressions, that certain arithmetic progressions contain infinitely many primes.{{cite book | last = Apostol | first = Tom M. | author-link = Tom M. Apostol | contribution = 7. Dirichlet's Theorem on Primes in Arithmetical Progressions | contribution-url = https://books.google.com/books?id=3yoBCAAAQBAJ&pg=PA146 | location = New York; Heidelberg | mr = 0434929 | pages = 146–156 | publisher = Springer-Verlag | title = Introduction to Analytic Number Theory | year = 1976 }}
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),{{cite book|title=A History of Algorithms: From the Pebble to the Microchip|first=Jean-Luc|last=Chabert|publisher=Springer|year=2012|isbn=978-3-642-18192-4|page=261|url=https://books.google.com/books?id=XcDqCAAAQBAJ&pg=PA261}} Proth's theorem (c. 1878),{{cite book|title=Elementary Number Theory and Its Applications|first=Kenneth H.|last=Rosen|edition=4th|publisher=Addison-Wesley|year=2000|isbn=978-0-201-87073-2|contribution=Theorem 9.20. Proth's Primality Test|page=342}} the Lucas–Lehmer primality test (originated 1856), and the generalized Lucas primality test.
Since 1951 all the largest known primes have been found using these tests on computers.{{efn|A 44-digit prime number found in 1951 by Aimé Ferrier with a mechanical calculator remains the largest prime not to have been found with the aid of electronic computers.{{cite book|title=The Once and Future Turing|first1=S. Barry|last1=Cooper|first2=Andrew|last2=Hodges|publisher=Cambridge University Press|year=2016|isbn=978-1-107-01083-3|pages=37–38|url=https://books.google.com/books?id=h12cCwAAQBAJ&pg=PA37}}}} The search for ever larger primes has generated interest outside mathematical circles, through the Great Internet Mersenne Prime Search and other distributed computing projects.{{harvnb|Rosen|2000}}, p. 245. The idea that prime numbers had few applications outside of pure mathematics{{efn|name="pure"|For instance, Beiler writes that number theorist Ernst Kummer loved his ideal numbers, closely related to the primes, "because they had not soiled themselves with any practical applications",{{cite book|title=Recreations in the Theory of Numbers: The Queen of Mathematics Entertains|first=Albert H.|last=Beiler|year=1999|publisher=Dover|orig-year=1966|isbn=978-0-486-21096-4|page=2|url=https://books.google.com/books?id=NbbbL9gMJ88C&pg=PA2|oclc=444171535}} and Katz writes that Edmund Landau, known for his work on the distribution of primes, "loathed practical applications of mathematics", and for this reason avoided subjects such as geometry that had already shown themselves to be useful.{{cite journal | last = Katz | first = Shaul | doi = 10.1017/S0269889704000092 | issue = 1–2 | journal = Science in Context | mr = 2089305 | pages = 199–234 | title = Berlin roots – Zionist incarnation: the ethos of pure mathematics and the beginnings of the Einstein Institute of Mathematics at the Hebrew University of Jerusalem | volume = 17 | year = 2004| s2cid = 145575536 }}}} was shattered in the 1970s when public-key cryptography and the RSA cryptosystem were invented, using prime numbers as their basis.{{cite book|title=Elementary Number Theory|series=Textbooks in mathematics|first1=James S.|last1=Kraft|first2=Lawrence C.|last2=Washington|publisher=CRC Press|year=2014|isbn=978-1-4987-0269-0|page=7|url=https://books.google.com/books?id=4NAqBgAAQBAJ&pg=PA7}}
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.{{cite book|title=Secret History: The Story of Cryptology|series=Discrete Mathematics and Its Applications|first=Craig P.|last=Bauer|publisher=CRC Press|year=2013|isbn=978-1-4665-6186-1|page=468|url=https://books.google.com/books?id=EBkEGAOlCDsC&pg=PA468}}{{cite book|title=Old and New Unsolved Problems in Plane Geometry and Number Theory|volume=11|series=Dolciani mathematical expositions|first1=Victor|last1=Klee|author1-link=Victor Klee|first2=Stan|last2=Wagon|author2-link=Stan Wagon|publisher=Cambridge University Press|year=1991|isbn=978-0-88385-315-3|page=224|url=https://books.google.com/books?id=tRdoIhHh3moC&pg=PA224}} 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.{{harvnb|Neale|2017}}, pp. 18, 47.
= Primality of one =
Most early Greeks did not even consider 1 to be a number,{{cite journal | last1 = Caldwell | first1 = Chris K. | last2 = Reddick | first2 = Angela | last3 = Xiong | first3 = Yeng | last4 = Keller | first4 = Wilfrid | issue = 9 | journal = Journal of Integer Sequences | mr = 3005523 | page = Article 12.9.8 | title = The history of the primality of one: a selection of sources | url = https://cs.uwaterloo.ca/journals/JIS/VOL15/Caldwell2/cald6.html | volume = 15 | year = 2012 }} For a selection of quotes from and about the ancient Greek positions on the status of 1 and 2, see in particular pp. 3–4. For the Islamic mathematicians, see p. 6.{{cite book|title=Speusippus of Athens: A Critical Study With a Collection of the Related Texts and Commentary|volume=39|series=Philosophia Antiqua : A Series of Monographs on Ancient Philosophy|first=Leonardo|last=Tarán|publisher=Brill|year=1981|isbn=978-90-04-06505-5|pages=35–38|url=https://books.google.com/books?id=cUPXqSb7V1wC&pg=PA35}} so they could not consider its primality. A few scholars in the Greek and later Roman tradition, including Nicomachus, Iamblichus, Boethius, and Cassiodorus, also considered the prime numbers to be a subdivision of the odd numbers, so they did not consider {{tmath|2}} to be prime either. However, Euclid and a majority of the other Greek mathematicians considered {{tmath|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 by the 17th century some of them included it as the first prime number.{{harvnb|Caldwell|Reddick|Xiong|Keller|2012}}, pp. 7–13. See in particular the entries for Stevin, Brancker, Wallis, and Prestet. In the mid-18th century, Christian Goldbach listed 1 as prime in his correspondence with Leonhard Euler;{{harvnb|Caldwell|Reddick|Xiong|Keller|2012}}, pp. 6–7. however, Euler himself did not consider 1 to be prime.{{harvnb|Caldwell|Reddick|Xiong|Keller|2012}}, p. 15. Many 19th century mathematicians still considered 1 to be prime, and Derrick Norman Lehmer included 1 in his list of primes less than ten million published in 1914.{{sfn|Conway|Guy|1996|pp=130}} Lists of primes that included 1 continued to be published as recently {{nowrap|as 1956.{{cite book | last=Riesel | first=Hans | author-link= Hans Riesel | title=Prime Numbers and Computer Methods for Factorization | publisher=Birkhäuser | location=Basel, Switzerland | isbn=978-0-8176-3743-9 | year=1994|page=36|edition=2nd|mr=1292250|url=https://books.google.com/books?id=ITvaBwAAQBAJ&pg=PA36 | doi=10.1007/978-1-4612-0251-6 }}{{cite book | last1=Conway | first1=John Horton | author1-link=John Horton Conway | last2=Guy | first2=Richard K. | author2-link=Richard K. Guy | title=The Book of Numbers |title-link=The Book of Numbers (math book) | publisher=Copernicus | location=New York | isbn=978-0-387-97993-9 | year=1996 | pages = [https://archive.org/details/bookofnumbers0000conw/page/129 129–130] | mr=1411676 | doi=10.1007/978-1-4612-4072-3 }}}} However, 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".
If 1 were to be considered a prime, many statements involving primes would need to be awkwardly reworded. 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 any number of copies of 1.{{cite journal | last1 = Caldwell | first1 = Chris K. | last2 = Xiong | first2 = Yeng | issue = 9 | journal = Journal of Integer Sequences | mr = 3005530 | page = Article 12.9.7 | title = What is the smallest prime? | url = https://cs.uwaterloo.ca/journals/JIS/VOL15/Caldwell1/cald5.pdf | volume = 15 | year = 2012}} 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.For the totient, see {{harvnb|Sierpiński|1988}}, [https://books.google.com/books?id=ktCZ2MvgN3MC&pg=PA245 p. 245]. For the sum of divisors, see {{cite book|title=How Euler Did It|series=MAA Spectrum|first=C. Edward|last=Sandifer|publisher=Mathematical Association of America|year=2007|isbn=978-0-88385-563-8|page=59|url=https://books.google.com/books?id=sohHs7ExOsYC&pg=PA59}}
Elementary properties
= Unique factorization =
{{Main|Fundamental theorem of arithmetic}}
Writing a number as a product of prime numbers is called a prime factorization of the number. For example:
:
50 &= 2\times 5\times 5\\
&=2\times 5^2.
\end{align}
The terms in the product are called prime factors. The same prime factor may occur more than once; this example has two copies of the prime factor When a prime occurs multiple times, exponentiation can be used to group together multiple copies of the same prime number: for example, in the second way of writing the product above, denotes the square or second power of {{tmath|>5}}.
The central importance of prime numbers to number theory and mathematics in general stems from the fundamental theorem of arithmetic.{{cite book|title=The Nature of Mathematics
|first=Karl J.|last=Smith|edition=12th|publisher=Cengage Learning|year=2011|isbn=978-0-538-73758-6|page=188|url=https://books.google.com/books?id=Di0HyCgDYq8C&pg=PA188}} 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.{{harvnb|Dudley|1978}}, [https://books.google.com/books?id=tr7SzBTsk1UC&pg=PA16 Section 2, Theorem 2, p. 16]; {{cite book|title=Closing the Gap: The Quest to Understand Prime Numbers|title-link= Closing the Gap: The Quest to Understand Prime Numbers |first=Vicky|last=Neale|author-link=Vicky Neale|publisher=Oxford University Press|year=2017|isbn=978-0-19-109243-5|at=[https://books.google.com/books?id=T7Q1DwAAQBAJ&pg=PA107 p. 107]}} 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.{{cite book|title=The Music of the Primes: Searching to Solve the Greatest Mystery in Mathematics|first=Marcus|last=du Sautoy|author-link=Marcus du Sautoy|publisher=Harper Collins|year=2003|isbn=978-0-06-093558-0|page=[https://archive.org/details/musicofprimessea00dusa/page/23 23]|url=https://archive.org/details/musicofprimessea00dusa|url-access=registration}}
Some proofs of the uniqueness of prime factorizations are based on Euclid's lemma: If {{tmath|p}} is a prime number and {{tmath|p}} divides a product of integers {{tmath|a}} and then {{tmath|p}} divides {{tmath|a}} or {{tmath|p}} divides {{tmath|b}} (or both).{{harvnb|Dudley|1978}}, [https://books.google.com/books?id=tr7SzBTsk1UC&pg=PA15 Section 2, Lemma 5, p. 15]; {{cite book|title=Mathematics for the Curious|first=Peter M.|last=Higgins|publisher=Oxford University Press |year=1998 |isbn=978-0-19-150050-3 |pages=77–78|url=https://books.google.com/books?id=LeYH8P8S9oQC&pg=PA77}} Conversely, if a number {{tmath|p}} has the property that when it divides a product it always divides at least one factor of the product, then {{tmath|p}} must be prime.{{cite book|title=A First Course in Abstract Algebra|first=Joseph J.|last=Rotman|edition=2nd|publisher=Prentice Hall|year=2000|isbn=978-0-13-011584-3|at=Problem 1.40, p. 56}}
= Infinitude =
{{Main|Euclid's theorem}}
There are infinitely many prime numbers. Another way of saying this is that the sequence
:
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,[http://www.math.dartmouth.edu/~euler/correspondence/letters/OO0722.pdf Letter] in Latin from Goldbach to Euler, July 1730. Furstenberg's proof using general topology,{{Cite journal | last1=Furstenberg | first1=Harry | author1-link=Hillel Furstenberg | title=On the infinitude of primes | doi=10.2307/2307043 | year=1955 | journal=American Mathematical Monthly | volume=62 | mr=0068566 | issue=5 | pages=353 | jstor=2307043 }}
and Kummer's elegant proof.{{cite book | last1=Ribenboim | first1=Paulo | author1-link=Paulo Ribenboim | title=The little book of bigger primes | publisher=Springer-Verlag | location=Berlin; New York | isbn=978-0-387-20169-6 | year=2004|page=4 | url=https://books.google.com/books?id=SvnTBwAAQBAJ&pg=PA5 }}
Euclid's proofEuclid's Elements, Book IX, Proposition 20. See [http://aleph0.clarku.edu/~djoyce/java/elements/bookIX/propIX20.html David Joyce's English translation of Euclid's proof] or {{cite book|url=https://babel.hathitrust.org/cgi/pt?id=umn.31951000084215o;view=1up;seq=95|title=The Elements of Euclid, With Dissertations|last=Williamson|first=James|publisher=Clarendon Press|year=1782|location=Oxford|page=63|oclc=642232959}} shows that every finite list of primes is incomplete. The key idea is to multiply together the primes in any given list and add If the list consists of the primes this gives the number
:
By the fundamental theorem, {{tmath|N}} has a prime factorization
:
with one or more prime factors. {{tmath|N}} is evenly divisible by each of these factors, but {{tmath|N}} has a remainder of one when divided by any of the prime numbers in the given list, so none of the prime factors of {{tmath|N}} can be in the given list. Because there is no finite list of all the primes, there must be infinitely many primes.
The numbers formed by adding one to the products of the smallest primes are called Euclid numbers.{{cite book|title=Computational Recreations in Mathematica|first=Ilan|last=Vardi|publisher=Addison-Wesley|year=1991|isbn=978-0-201-52989-0|pages=82–89}} The first five of them are prime, but the sixth,
:
is a composite number.
= Formulas for primes =
{{main|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.{{cite journal | last = Mackinnon | first = Nick | date = June 1987 | doi = 10.2307/3616496 | issue = 456 | pages = 113–114 | journal = The Mathematical Gazette | title = Prime number formulae | volume = 71| jstor = 3616496 | s2cid = 171537609 }} 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.{{cite book | last = Matiyasevich | first = Yuri V. | author-link = Yuri Matiyasevich | year=1999 | chapter = Formulas for prime numbers | chapter-url=https://books.google.com/books?id=oLKlk5o6WroC&pg=PA13 | editor1-first=Serge | editor1-last = Tabachnikov | editor-link1=Sergei Tabachnikov| title = Kvant Selecta: Algebra and Analysis | volume = II | publisher = American Mathematical Society | isbn = 978-0-8218-1915-9 | pages=13–24}}
Other examples of prime-generating formulas come from Mills' theorem and a theorem of Wright. These assert that there are real constants and such that
:
are prime for any natural number {{tmath|n}} in the first formula, and any number of exponents in the second formula.{{cite journal |first=E.M. |last= Wright | author-link=E. M. Wright |title=A prime-representing function |journal=American Mathematical Monthly |volume=58 |issue=9 |year=1951 |pages=616–618 |jstor=2306356 |doi= 10.2307/2306356}} Here represents the floor function, the largest integer less than or equal to the number in question. However, these are not useful for generating primes, as the primes must be generated first in order to compute the values of {{tmath|A}} or
= Open questions =
{{Further|:Category:Conjectures about prime numbers}}
Many conjectures revolving about primes have been posed. Often having an elementary formulation, many of these conjectures have withstood proof for decades: all four of Landau's problems from 1912 are still unsolved.{{harvnb|Guy|2013}}, [https://books.google.com/books?id=EbLzBwAAQBAJ&pg=PR7 p. vii]. One of them is Goldbach's conjecture, which asserts that every even integer {{tmath|n}} greater than {{tmath|2}} can be written as a sum of two primes.{{harvnb|Guy|2013}}, [https://books.google.com/books?id=EbLzBwAAQBAJ&pg=PA105 C1 Goldbach's conjecture, pp. 105–107]. {{As of|2014}}, this conjecture has been verified for all numbers up to {{cite journal | last1 = Oliveira e Silva | first1 = Tomás | last2 = Herzog | first2 = Siegfried | last3 = Pardi | first3 = Silvio | doi = 10.1090/S0025-5718-2013-02787-1 | issue = 288 | journal = Mathematics of Computation | mr = 3194140 | pages = 2033–2060 | title = Empirical verification of the even Goldbach conjecture and computation of prime gaps up to | volume = 83 | year = 2014| doi-access = free }} Weaker statements than this have been proven; for example, Vinogradov's theorem says that every sufficiently large odd integer can be written as a sum of three primes.{{harvnb|Tao|2009}}, [https://books.google.com/books?id=NxnVAwAAQBAJ&pg=PA239 3.1 Structure and randomness in the prime numbers, pp. 239–247]. See especially p. 239. Chen's theorem says that every sufficiently large even number can be expressed as the sum of a prime and a semiprime (the product of two primes).{{harvnb|Guy|2013}}, p. 159. Also, any even integer greater than 10 can be written as the sum of six primes.{{cite journal | last = Ramaré | first = Olivier | issue = 4 | journal = Annali della Scuola Normale Superiore di Pisa | mr = 1375315 | pages = 645–706 | title = On Šnirel'man's constant | url = https://www.numdam.org/item?id=ASNSP_1995_4_22_4_645_0 | volume = 22 | year = 1995 | access-date = 2018-01-23 | archive-date = 2022-02-09 | archive-url = https://web.archive.org/web/20220209175544/http://www.numdam.org/item/?id=ASNSP_1995_4_22_4_645_0 | url-status = dead }} The branch of number theory studying such questions is called additive number theory.{{cite book | last = Rassias | first = Michael Th. | doi = 10.1007/978-3-319-57914-6 | isbn = 978-3-319-57912-2 | location = Cham | mr = 3674356 | page = vii | publisher = Springer | title = Goldbach's Problem: Selected Topics | url = https://books.google.com/books?id=ibwpDwAAQBAJ&pg=PP6 | year = 2017}}
Another type of problem concerns prime gaps, the differences between consecutive primes.
The existence of arbitrarily large prime gaps can be seen by noting that the sequence consists of composite numbers, for any natural number {{harvnb|Koshy|2002}}, [https://books.google.com/books?id=-9pg-4Pa19IC&pg=PA109 Theorem 2.14, p. 109]. {{harvnb|Riesel|1994}} gives a similar argument using the primorial in place of the factorial. However, large prime gaps occur much earlier than this argument shows. For example, the first prime gap of length 8 is between the primes 89 and 97,{{cite OEIS|A100964|name=Smallest prime number that begins a prime gap of at least 2n}} much smaller than It is conjectured that there are infinitely many twin primes, pairs of primes with difference 2; this is the twin prime conjecture. Polignac's conjecture states more generally that for every positive integer there are infinitely many pairs of consecutive primes that differ by {{harvnb|Ribenboim|2004}}, Gaps between primes, pp. 186–192.
Andrica's conjecture, Brocard's conjecture,{{harvnb|Ribenboim|2004}}, p. 183. Legendre's conjecture,{{cite journal | last = Chan | first = Joel | title = Prime time! | journal = Math Horizons | volume = 3 | issue = 3 | date = February 1996 | pages = 23–25 | jstor = 25678057| doi = 10.1080/10724117.1996.11974965 }} Note that Chan lists Legendre's conjecture as "Sierpinski's Postulate". and Oppermann's conjecture all suggest that the largest gaps between primes from 1 to {{tmath|n}} should be at most approximately a result that is known to follow from the Riemann hypothesis, while the much stronger Cramér conjecture sets the largest gap size at {{tmath| O((\log n)^2) }}. Prime gaps can be generalized to Prime k-tuple, patterns in the differences among more than two prime numbers. Their infinitude and density are the subject of the first Hardy–Littlewood conjecture, which can be motivated by the heuristic that the prime numbers behave similarly to a random sequence of numbers with density given by the prime number theorem.{{harvnb|Ribenboim|2004}}, Prime {{tmath|k}}-tuples conjecture, pp. 201–202.
Analytic properties
Analytic number theory studies number theory through the lens of continuous functions, limits, infinite series, and the related mathematics of the infinite and infinitesimal.
This area of study began with Leonhard Euler and his first major result, the solution to the Basel problem.
The problem asked for the value of the infinite sum
which today can be recognized as the value of the Riemann zeta function. This function is closely connected to the prime numbers and to one of the most significant unsolved problems in mathematics, the Riemann hypothesis. Euler showed that {{tmath|1= \zeta(2)=\pi^2/6 }}.{{harvnb|Sandifer|2007}}, [https://books.google.com/books?id=sohHs7ExOsYC&pg=PA205 Chapter 35, Estimating the Basel problem, pp. 205–208].
The reciprocal of this number, {{tmath|6/\pi^2}}, is the limiting probability that two random numbers selected uniformly from a large range are relatively prime (have no factors in common).{{cite book | last1 = Ogilvy | first1 = C.S. | author1-link = C. Stanley Ogilvy | last2 = Anderson | first2 = J.T. | isbn = 978-0-486-25778-5 | pages = 29–35 | publisher = Dover Publications Inc. | title = Excursions in Number Theory | url = https://books.google.com/books?id=efbaDLlTXvMC&pg=PA29 | year = 1988}}
The distribution of primes in the large, such as the question how many primes are smaller than a given, large threshold, is described by the prime number theorem, but no efficient formula for primes is known. Dirichlet's theorem on arithmetic progressions, in its basic form, asserts that linear polynomials
:
with relatively prime integers {{tmath|a}} and {{tmath|b}} take infinitely many prime values. Stronger forms of the theorem state that the sum of the reciprocals of these prime values diverges, and that different linear polynomials with the same {{tmath|b}} have approximately the same proportions of primes.
Although conjectures have been formulated about the proportions of primes in higher-degree polynomials, they remain unproven, and it is unknown whether there exists a quadratic polynomial that (for integer arguments) is prime infinitely often.
= Analytical proof of Euclid's theorem =
Euler's proof that there are infinitely many primes considers the sums of reciprocals of primes,
:
Euler showed that, for any arbitrary real number {{tmath|x}}, there exists a prime {{tmath|p}} for which this sum is greater than {{tmath|x}}.{{harvnb|Apostol|1976}}, Section 1.6, Theorem 1.13 This shows that there are infinitely many primes, because if there were finitely many primes the sum would reach its maximum value at the biggest prime rather than growing past every {{tmath|x}}.
The growth rate of this sum is described more precisely by Mertens' second theorem.{{harvnb|Apostol|1976}}, Section 4.8, Theorem 4.12 For comparison, the sum
:
does not grow to infinity as {{tmath|n}} goes to infinity (see the Basel problem). In this sense, prime numbers occur more often than squares of natural numbers,
although both sets are infinite.{{cite book|title=An Invitation to Modern Number Theory|first1=Steven J.|last1=Miller|first2=Ramin|last2=Takloo-Bighash|publisher=Princeton University Press|year=2006|isbn=978-0-691-12060-7|pages=43–44|url=https://books.google.com/books?id=kLz4z8iwKiwC&pg=PA43}} Brun's theorem states that the sum of the reciprocals of twin primes,
:
is finite. 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 =
{{Main|Prime number theorem|Prime-counting function}}
File:Prime-counting relative error.svg of and the logarithmic integral as approximations to the prime-counting function. Both relative errors decrease to zero as {{tmath|n}} grows, but the convergence to zero is much more rapid for the logarithmic integral.]]
The prime-counting function is defined as the number of primes not greater than {{tmath|n}}.{{harvnb|Crandall|Pomerance|2005}}, [https://books.google.com/books?id=RbEz-_D7sAUC&pg=PA6 p. 6]. For example, {{tmath|1= \pi(11)=5 }}, since there are five primes less than or equal to 11. Methods such as the Meissel–Lehmer algorithm can compute exact values of faster than it would be possible to list each prime up to {{tmath|n}}.{{harvnb|Crandall|Pomerance|2005}}, [https://books.google.com/books?id=ZXjHKPS1LEAC&pg=PA152 Section 3.7, Counting primes, pp. 152–162]. The prime number theorem states that is asymptotic to {{tmath| n/\log n }}, which is denoted as
:
and means that the ratio of to the right-hand fraction approaches 1 as {{tmath|n}} grows to infinity.{{harvnb|Crandall|Pomerance|2005}}, [https://books.google.com/books?id=RbEz-_D7sAUC&pg=PA10 p. 10]. This implies that the likelihood that a randomly chosen number less than {{tmath|n}} is prime is (approximately) inversely proportional to the number of digits in {{tmath|n}}.{{cite book|title=The Number Mysteries: A Mathematical Odyssey through Everyday Life|first=Marcus|last=du Sautoy|author-link=Marcus du Sautoy|publisher=St. Martin's Press|year=2011|isbn=978-0-230-12028-0|pages=50–52|contribution=What are the odds that your telephone number is prime?|contribution-url=https://books.google.com/books?id=snaUbkIb8SEC&pg=PA50}}
It also implies that the {{tmath|n}}th prime number is proportional to {{harvnb|Apostol|1976}}, Section 4.6, Theorem 4.7
and therefore that the average size of a prime gap is proportional to {{tmath| \log n }}.{{harvnb|Riesel|1994}}, "[https://books.google.com/books?id=ITvaBwAAQBAJ&pg=PA78 Large gaps between consecutive primes]", pp. 78–79.
A more accurate estimate for is given by the offset logarithmic integral
:
= Arithmetic progressions =
{{main|Dirichlet's theorem on arithmetic progressions|Green–Tao theorem}}
An arithmetic progression is a finite or infinite sequence of numbers such that consecutive numbers in the sequence all have the same difference.{{cite book |last1=Gelfand |first1=Israel M. |author1-link=Israel Gelfand |url=https://books.google.com/books?id=Z9z7iliyFD0C&pg=PA37 |title=Algebra |last2=Shen |first2=Alexander |publisher=Springer |year=2003 |isbn=978-0-8176-3677-7 |page=37}} This difference is called the modulus of the progression.{{cite book|title=Fundamental Number Theory with Applications|series=Discrete Mathematics and Its Applications|first=Richard A.|last=Mollin|publisher=CRC Press|year=1997|isbn=978-0-8493-3987-5|page=76|url=https://books.google.com/books?id=Fsaa3MUUQYkC&pg=PA76}} For example,
:
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
:
can have more than one prime only when its remainder {{tmath|a}} and modulus {{tmath|q}} are relatively prime. If they are relatively prime, Dirichlet's theorem on arithmetic progressions asserts that the progression contains infinitely many primes.{{harvnb|Crandall|Pomerance|2005}}, [https://books.google.com/books?id=ZXjHKPS1LEAC&pg=PA Theorem 1.1.5, p. 12].
{{Wide image|Prime numbers in arithmetic progression mod 9 zoom in.png|815px|Primes in the arithmetic progressions modulo 9. Each row of the thin horizontal band shows one of the nine possible progressions mod 9, with prime numbers marked in red. The progressions of numbers that are 0, 3, or 6 mod 9 contain at most one prime number (the number 3); the remaining progressions of numbers that are 2, 4, 5, 7, and 8 mod 9 have infinitely many prime numbers, with similar numbers of primes in each progression.|alt=Prime numbers in arithmetic progression mod 9}}
The Green–Tao theorem shows that there are arbitrarily long finite arithmetic progressions consisting only of primes.{{cite journal|first1=Ben|last1=Green|author1-link=Ben J. Green|first2=Terence|last2=Tao|author2-link=Terence Tao|title=The primes contain arbitrarily long arithmetic progressions|journal=Annals of Mathematics|volume=167|issue=2|year=2008|pages=481–547|doi=10.4007/annals.2008.167.481|arxiv=math.NT/0404188|s2cid=1883951}}
= Prime values of quadratic polynomials =
File:Ulam 2.png. Prime numbers (orange) cluster on some diagonals and not others. Prime values of are shown in blue.|alt=The Ulam spiral]]
Euler noted that the function
:
yields prime numbers for {{tmath| 1\le n\le 40 }}, although composite numbers appear among its later values.{{cite book |last1=Hua |first1=L. K. |title=Additive Theory of Prime Numbers |publisher=American Mathematical Society |year=2009 |isbn=978-0-8218-4942-2 |series=Translations of Mathematical Monographs |volume=13 |location=Providence, RI |pages=176–177 |mr=0194404 |oclc=824812353 |orig-year=1965}}The sequence of these primes, starting at rather than {{tmath|1= n=0 }}, is listed by {{cite book|title=103 curiosità matematiche: Teoria dei numeri, delle cifre e delle relazioni nella matematica contemporanea|language=it|first1=Paolo Pietro|last1=Lava|first2=Giorgio|last2=Balzarotti|publisher=Ulrico Hoepli Editore S.p.A.|year=2010|isbn=978-88-203-5804-4|page=133|contribution-url=https://books.google.com/books?id=YfsSAAAAQBAJ&pg=PA133|contribution=Chapter 33. Formule fortunate}} The search for an explanation for this phenomenon led to the deep algebraic number theory of Heegner numbers and the class number problem.{{cite book|title=Single Digits: In Praise of Small Numbers|first=Marc|last=Chamberland|publisher=Princeton University Press|year=2015|isbn=978-1-4008-6569-7|contribution=The Heegner numbers|pages=213–215|contribution-url=https://books.google.com/books?id=n9iqBwAAQBAJ&pg=PA213}} The Hardy–Littlewood conjecture F predicts the density of primes among the values of quadratic polynomials with integer coefficients in terms of the logarithmic integral and the polynomial coefficients. No quadratic polynomial has been proven to take infinitely many prime values.{{cite book|title=Unsolved Problems in Number Theory|series=Problem Books in Mathematics|edition=3rd|first=Richard|last=Guy|author-link=Richard K. Guy|publisher=Springer|year=2013|isbn=978-0-387-26677-0|pages=7–10|contribution-url=https://books.google.com/books?id=1BnoBwAAQBAJ&pg=PA7|contribution=A1 Prime values of quadratic functions}}
The Ulam spiral{{Cite journal |last1=Stein |first1=M.L. |last2=Ulam |first2=S.M. |last3=Wells |first3=M.B. |date=1964 |title=A Visual Display of Some Properties of the Distribution of Primes |url=https://www.jstor.org/stable/2312588 |journal=The American Mathematical Monthly |volume=71 |issue=5 |pages=516–520 |doi=10.2307/2312588|jstor=2312588 }} 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|Riemann hypothesis}}
File:Riemann zeta function absolute value.png
One of the most famous unsolved questions in mathematics, dating from 1859, and one of the Millennium Prize Problems, is the Riemann hypothesis, which asks where the zeros of the Riemann zeta function are located.
This function is an analytic function on the complex numbers. For complex numbers {{tmath|s}} with real part greater than one it equals both an infinite sum over all integers, and an infinite product over the prime numbers,
:
This equality between a sum and a product, discovered by Euler, is called an Euler product.{{cite book |last=Patterson |first=S. J. |url=https://books.google.com/books?id=IdHLCgAAQBAJ&pg=PA1 |title=An introduction to the theory of the Riemann zeta-function |publisher=Cambridge University Press, Cambridge |year=1988 |isbn=978-0-521-33535-5 |series=Cambridge Studies in Advanced Mathematics |volume=14 |page=1 |doi=10.1017/CBO9780511623707 |mr=933558}} The Euler product can be derived from the fundamental theorem of arithmetic, and shows the close connection between the zeta function and the prime numbers.{{cite book | last1 = Borwein | first1 = Peter | author1-link = Peter Borwein | last2 = Choi | first2 = Stephen | last3 = Rooney | first3 = Brendan | last4 = Weirathmueller | first4 = Andrea | doi = 10.1007/978-0-387-72126-2 | isbn = 978-0-387-72125-5 | location = New York | mr = 2463715 | pages = 10–11 | publisher = Springer | series = CMS Books in Mathematics/Ouvrages de Mathématiques de la SMC | title = The Riemann hypothesis: A resource for the afficionado and virtuoso alike | url = https://books.google.com/books?id=Qm1aZA-UwX4C&pg=PA10 | year = 2008 }}
It leads to another proof that there are infinitely many primes: if there were only finitely many,
then the sum-product equality would also be valid at {{tmath|1= s=1 }}, but the sum would diverge (it is the harmonic series {{tmath|1+\tfrac{1}{2}+\tfrac{1}{3}+\dots}}) while the product would be finite, a contradiction.{{harvnb|Sandifer|2007}}, [https://books.google.com/books?id=sohHs7ExOsYC&pg=PA191 pp. 191–193].
The Riemann hypothesis states that the zeros of the zeta-function are all either negative even numbers, or complex numbers with real part equal to 1/2.{{harvnb|Borwein|Choi|Rooney|Weirathmueller|2008}}, [https://books.google.com/books?id=Qm1aZA-UwX4C&pg=PA15 Conjecture 2.7 (the Riemann hypothesis), p. 15]. The original proof of the prime number theorem was based on a weak form of this hypothesis, that there are no zeros with real part equal to 1,{{harvnb|Patterson|1988}}, p. 7.{{harvnb|Borwein|Choi|Rooney|Weirathmueller|2008}}, [https://books.google.com/books?id=Qm1aZA-UwX4C&pg=PA18 p. 18.] although other more elementary proofs have been found.{{harvnb|Nathanson|2000}}, [https://books.google.com/books?id=sE7lBwAAQBAJ&pg=PA289 Chapter 9, The prime number theorem, pp. 289–324]. The prime-counting function can be expressed by Riemann's explicit formula as a sum in which each term comes from one of the zeros of the zeta function; the main term of this sum is the logarithmic integral, and the remaining terms cause the sum to fluctuate above and below the main term.{{cite journal | last = Zagier | first = Don | author-link = Don Zagier | doi = 10.1007/bf03351556 | issue = S2 | journal = The Mathematical Intelligencer | pages = 7–19 | title = The first 50 million prime numbers | volume = 1 | year = 1977| s2cid = 37866599 }} See especially pp. 14–16. In this sense, the zeros control how regularly the prime numbers are distributed. If the Riemann hypothesis is true, these fluctuations will be small, and the
asymptotic distribution of primes given by the prime number theorem will also hold over much shorter intervals (of length about the square root of {{tmath|x}} for intervals near a number {{tmath|x}}).
Abstract algebra
= Modular arithmetic and finite fields =
{{Main|Modular arithmetic}}
Modular arithmetic modifies usual arithmetic by only using the numbers {{tmath|\{0,1,2,\dots,n-1\} }}, for a natural number {{tmath|n}} called the modulus.
Any other natural number can be mapped into this system by replacing it by its remainder after division by {{tmath|n}}.{{harvtxt|Kraft|Washington|2014}}, [https://books.google.com/books?id=VG9YBQAAQBAJ&pg=PA96 Proposition 5.3], p. 96. Modular sums, differences and products are calculated by performing the same replacement by the remainder on the result of the usual sum, difference, or product of integers.{{cite book|title=Algebra in Action: A Course in Groups, Rings, and Fields|volume=27|series=Pure and Applied Undergraduate Texts|first=Shahriar|last=Shahriari|author-link= Shahriar Shahriari |publisher=American Mathematical Society|year=2017|isbn=978-1-4704-2849-5|pages=20–21|url=https://books.google.com/books?id=GJwxDwAAQBAJ&pg=PA20}} Equality of integers corresponds to congruence in modular arithmetic: {{tmath|x}} and {{tmath|y}} are congruent (written mod {{tmath|n}}) when they have the same remainder after division by {{tmath|n}}.{{harvnb|Dudley|1978}}, [https://books.google.com/books?id=tr7SzBTsk1UC&pg=PA28 Theorem 3, p. 28]. However, in this system of numbers, division by all nonzero numbers is possible if and only if the modulus is prime. For instance, with the prime number 7 as modulus, division by 3 is possible: {{tmath| 2/3\equiv 3\bmod{7} }}, because clearing denominators by multiplying both sides by 3 gives the valid formula {{tmath| 2\equiv 9\bmod{7} }}. However, with the composite modulus 6, division by 3 is impossible. There is no valid solution to : clearing denominators by multiplying by 3 causes the left-hand side to become 2 while the right-hand side becomes either 0 or 3. In the terminology of abstract algebra, the ability to perform division means that modular arithmetic modulo a prime number forms a field or, more specifically, a finite field, while other moduli only give a ring but not a field.{{harvnb|Shahriari|2017}}, [https://books.google.com/books?id=GJwxDwAAQBAJ&pg=PA27 pp. 27–28].
Several theorems about primes can be formulated using modular arithmetic. For instance, Fermat's little theorem states that if (mod {{tmath|p}}), then (mod {{tmath|p}}).{{harvnb|Ribenboim|2004}}, Fermat's little theorem and primitive roots modulo a prime, pp. 17–21. Summing this over all choices of {{tmath|a}} gives the equation
:
valid whenever {{tmath|p}} is prime.
Giuga's conjecture says that this equation is also a sufficient condition for {{tmath|p}} to be prime.{{harvnb|Ribenboim|2004}}, The property of Giuga, pp. 21–22. Wilson's theorem says that an integer is prime if and only if the factorial is congruent to mod {{tmath|p}}. For a composite number {{tmath|1= n = r\cdot s }} this cannot hold, since one of its factors divides both {{mvar|n}} and {{tmath|(n-1)!}}, and so is impossible.{{harvnb|Ribenboim|2004}}, The theorem of Wilson, p. 21.
= ''p''-adic numbers =
{{main|p-adic number}}
The p-adic order of an integer {{tmath|n}} is the number of copies of {{tmath|p}} in the prime factorization of {{tmath|n}}. The same concept can be extended from integers to rational numbers by defining the {{tmath|p}}-adic order of a fraction to be {{tmath|\nu_p(m)-\nu_p(n)}}. The {{tmath|p}}-adic absolute value of any rational number {{tmath|q}} is then defined as {{tmath|1= \vert q \vert_p=p^{-\nu_p(q)} }}. Multiplying an integer by its {{tmath|p}}-adic absolute value cancels out the factors of {{tmath|p}} in its factorization, leaving only the other primes. Just as the distance between two real numbers can be measured by the absolute value of their distance, the distance between two rational numbers can be measured by their {{tmath|p}}-adic distance, the {{tmath|p}}-adic absolute value of their difference. For this definition of distance, two numbers are close together (they have a small distance) when their difference is divisible by a high power of {{tmath|p}}. In the same way that the real numbers can be formed from the rational numbers and their distances, by adding extra limiting values to form a complete field, the rational numbers with the {{tmath|p}}-adic distance can be extended to a different complete field, the p-adic number.{{cite book | last1 = Erickson | first1 = Marty | last2 = Vazzana | first2 = Anthony | last3 = Garth | first3 = David | edition = 2nd | isbn = 978-1-4987-1749-6 | mr = 3468748 | page = 200 | publisher = CRC Press | location = Boca Raton, FL | series = Textbooks in Mathematics | title = Introduction to Number Theory | url = https://books.google.com/books?id=QpLwCgAAQBAJ&pg=PA200 | year = 2016}}
This picture of an order, absolute value, and complete field derived from them can be generalized to algebraic number fields and their valuations (certain mappings from the multiplicative group of the field to a totally ordered additive group, also called orders), absolute values (certain multiplicative mappings from the field to the real numbers, also called norms),{{cite book | last = Childress | first = Nancy | doi = 10.1007/978-0-387-72490-4 | isbn = 978-0-387-72489-8 | mr = 2462595 | pages = 8–11 | publisher = Springer, New York | series = Universitext | title = Class Field Theory | url = https://books.google.com/books?id=RYdy4PCJYosC&pg=PA8 | year = 2009 }} See also p. 64. and places (extensions to complete fields in which the given field is a dense set, also called completions).{{cite book | last = Weil | first = André | author-link = André Weil | isbn = 978-3-540-58655-5 | mr = 1344916 | page = [https://archive.org/details/basicnumbertheor00weil_866/page/n56 43] | publisher = Springer-Verlag | location = Berlin | series = Classics in Mathematics | title = Basic Number Theory | url = https://archive.org/details/basicnumbertheor00weil_866 | url-access = limited | year = 1995}} Note however that some authors such as {{harvtxt|Childress|2009}} instead use "place" to mean an equivalence class of norms. The extension from the rational numbers to the real numbers, for instance, is a place in which the distance between numbers is the usual absolute value of their difference. The corresponding mapping to an additive group would be the logarithm of the absolute value, although this does not meet all the requirements of a valuation. According to Ostrowski's theorem, up to a natural notion of equivalence, the real numbers and {{tmath|p}}-adic numbers, with their orders and absolute values, are the only valuations, absolute values, and places on the rational numbers. The local–global principle allows certain problems over the rational numbers to be solved by piecing together solutions from each of their places, again underlining the importance of primes to number theory.{{cite book | last = Koch | first = H. | doi = 10.1007/978-3-642-58095-6 | isbn = 978-3-540-63003-6 | mr = 1474965 | page = 136 | publisher = Springer-Verlag | location = Berlin | title = Algebraic Number Theory | url = https://books.google.com/books?id=wt1sCQAAQBAJ&pg=PA136 | year = 1997| citeseerx = 10.1.1.309.8812 }}
= Prime elements of a ring =
{{Main|Prime element|Irreducible element}}
File:Gaussian primes.svgs with norm squared less than 500]]
A commutative ring is an algebraic structure where addition, subtraction and multiplication are defined. The integers are a ring, and the prime numbers in the integers have been generalized to rings in two different ways, prime elements and irreducible elements. An element {{tmath|p}} of a ring {{tmath|R}} is called prime if it is nonzero, has no multiplicative inverse (that is, it is not a unit), and satisfies the following requirement: whenever {{tmath|p}} divides the product of two elements of {{tmath|R}}, it also divides at least one of {{tmath|x}} or {{tmath|y}}. An element is irreducible if it is neither a unit nor the product of two other non-unit elements. In the ring of integers, the prime and irreducible elements form the same set,
:
In an arbitrary ring, all prime elements are irreducible. The converse does not hold in general, but does hold for unique factorization domains.{{cite book | last = Lauritzen | first = Niels | doi = 10.1017/CBO9780511804229 | isbn = 978-0-521-53410-9 | location = Cambridge | mr = 2014325 | page = 127 | publisher = Cambridge University Press | title = Concrete Abstract Algebra: From numbers to Gröbner bases | url = https://books.google.com/books?id=BdAbcje-TZUC&pg=PA127 | year = 2003 }}
The fundamental theorem of arithmetic continues to hold (by definition) in unique factorization domains. An example of such a domain is the Gaussian integers {{tmath|\mathbb{Z}[i]}}, the ring of complex numbers of the form where {{tmath|i}} denotes the imaginary unit and {{tmath|a}} and {{tmath|b}} are arbitrary integers. Its prime elements are known as Gaussian primes. Not every number that is prime among the integers remains prime in the Gaussian integers; for instance, the number 2 can be written as a product of the two Gaussian primes and {{tmath|1-i}}. Rational primes (the prime elements in the integers) congruent to 3 mod 4 are Gaussian primes, but rational primes congruent to 1 mod 4 are not.{{harvnb|Lauritzen|2003}}, Corollary 3.5.14, p. 133; Lemma 3.5.18, p. 136. This is a consequence of Fermat's theorem on sums of two squares,
which states that an odd prime {{tmath|p}} is expressible as the sum of two squares, {{tmath|1= p=x^2+y^2 }}, and therefore factorable as {{tmath|1= p=(x+iy)(x-iy) }}, exactly when {{tmath|p}} is 1 mod 4.{{harvnb|Kraft|Washington|2014}}, [https://books.google.com/books?id=4NAqBgAAQBAJ&pg=PA297 Section 12.1, Sums of two squares, pp. 297–301].
= Prime ideals =
{{Main|Prime ideals}}
Not every ring is a unique factorization domain. For instance, in the ring of numbers (for integers {{tmath|a}} and {{tmath|b}}) the number has two factorizations {{tmath|1= 21=3\cdot7=(1+2\sqrt{-5})(1-2\sqrt{-5}) }}, where neither of the four factors can be reduced any further, so it does not have a unique factorization. In order to extend unique factorization to a larger class of rings, the notion of a number can be replaced with that of an ideal, a subset of the elements of a ring that contains all sums of pairs of its elements, and all products of its elements with ring elements.
Prime ideals, which generalize prime elements in the sense that the principal ideal generated by a prime element is a prime ideal, are an important tool and object of study in commutative algebra, algebraic number theory and algebraic geometry. The prime ideals of the ring of integers are the ideals {{tmath|(0)}}, {{tmath|(2)}}, {{tmath|(3)}}, {{tmath|(5)}}, {{tmath|(7)}}, {{tmath|(11)}}, ... The fundamental theorem of arithmetic generalizes to the Lasker–Noether theorem, which expresses every ideal in a Noetherian commutative ring as an intersection of primary ideals, which are the appropriate generalizations of prime powers.{{cite book | last1=Eisenbud | first1=David | author1-link= David Eisenbud | title=Commutative Algebra | publisher=Springer-Verlag | location=Berlin; New York | series=Graduate Texts in Mathematics | isbn=978-0-387-94268-1| mr=1322960 | year=1995 | volume=150 | at=Section 3.3| doi=10.1007/978-1-4612-5350-1 }}
The spectrum of a ring is a geometric space whose points are the prime ideals of the ring.{{cite book | last = Shafarevich | first = Igor R. | author-link = Igor Shafarevich | doi = 10.1007/978-3-642-38010-5 | edition = 3rd | isbn = 978-3-642-38009-9 | mr = 3100288 | publisher = Springer, Heidelberg | title = Basic Algebraic Geometry 2: Schemes and Complex Manifolds | year = 2013 | contribution = Definition of | page = 5 | contribution-url = https://books.google.com/books?id=zDW8BAAAQBAJ&pg=PA5}} Arithmetic geometry also benefits from this notion, and many concepts exist in both geometry and number theory. 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. 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.{{cite book | last = Neukirch | first = Jürgen | author-link = Jürgen Neukirch | doi = 10.1007/978-3-662-03983-0 | isbn = 978-3-540-65399-8 | location = Berlin | mr = 1697859 | publisher = Springer-Verlag | series = Grundlehren der Mathematischen Wissenschaften [Fundamental Principles of Mathematical Sciences] | title = Algebraic Number Theory | volume = 322 | year = 1999 | at = Section I.8, p. 50}} 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.{{harvnb|Neukirch|1999}}, Section I.7, p. 38 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.{{cite journal | last1 = Stevenhagen | first1 = P. | last2 = Lenstra | first2 = H.W. Jr. | author2-link = Hendrik Lenstra | doi = 10.1007/BF03027290 | issue = 2 | journal = The Mathematical Intelligencer | mr = 1395088 | pages = 26–37 | title = Chebotarëv and his density theorem | volume = 18 | year = 1996| citeseerx = 10.1.1.116.9409 | s2cid = 14089091 }}
= Group theory =
In the theory of finite groups the Sylow theorems imply that, if a power of a prime number divides the order of a group, then the group has a subgroup of order {{tmath|p^n}}. By Lagrange's theorem, any group of prime order is a cyclic group,
and by Burnside's theorem any group whose order is divisible by only two primes is solvable.{{cite book|title=The Theory of Groups|series=Dover Books on Mathematics|first=Marshall|last=Hall|author-link=Marshall Hall (mathematician)|publisher=Courier Dover Publications|year=2018|isbn=978-0-486-81690-6|url=https://books.google.com/books?id=K8hEDwAAQBAJ}} For the Sylow theorems see p. 43; for Lagrange's theorem, see p. 12; for Burnside's theorem see p. 143.
Computational methods
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{{efn|name="pure"}} other than the use of prime numbered gear teeth to distribute wear evenly.{{cite book|title=How Round is Your Circle?: Where Engineering and Mathematics Meet|title-link=How Round Is Your Circle|first1=John|last1=Bryant|first2=Christopher J.|last2=Sangwin|publisher=Princeton University Press|year=2008|isbn=978-0-691-13118-4|at=[https://books.google.com/books?id=iIN_2WjBH1cC&pg=PA178 p. 178]}} In particular, number theorists such as British mathematician G. H. Hardy prided themselves on doing work that had absolutely no military significance.{{cite book|title=A Mathematician's Apology|last1=Hardy|first1=Godfrey Harold|publisher=Cambridge University Press|year=2012|isbn=978-0-521-42706-7|page=[https://books.google.com/books?id=EkY2im6xkVkC&pg=PA140 140]|oclc=922010634|quote=No one has yet discovered any warlike purpose to be served by the theory of numbers or relativity, and it seems unlikely that anyone will do so for many years.|author1-link=G. H. Hardy|orig-year=1940|title-link=A Mathematician's Apology}}
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.
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. 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. Prime numbers are also used in computing for checksums, hash tables, and pseudorandom number generators.
= Trial division =
{{main|Trial division}}
The most basic method of checking the primality of a given integer {{tmath|n}} is called trial division. This method divides {{tmath|n}} by each integer from 2 up to the square root of {{tmath|n}}. Any such integer dividing {{tmath|n}} evenly establishes {{tmath|n}} as composite; otherwise it is prime. Integers larger than the square root do not need to be checked because, whenever {{tmath|1= n = a\cdot b }}, one of the two factors {{tmath|a}} and {{tmath|b}} is less than or equal to the square root of {{tmath|n}}. Another optimization is to check only primes as factors in this range.{{cite book|title=Primes and Programming|first=Peter|last=Giblin|author-link=Peter Giblin|publisher=Cambridge University Press|year=1993|isbn=978-0-521-40988-9|page=[https://archive.org/details/primesprogrammin0000gibl/page/39 39]|url=https://archive.org/details/primesprogrammin0000gibl|url-access=registration}} For instance, to check whether 37 is prime, this method divides it by the primes in the range from 2 to {{tmath|\sqrt{37} }}, which are 2, 3, and 5. Each division produces a nonzero remainder, so 37 is indeed prime.
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.{{harvnb|Giblin|1993}}, [https://archive.org/details/primesprogrammin0000gibl/page/54 p. 54] 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.{{harvnb|Riesel|1994}}, [https://books.google.com/books?id=ITvaBwAAQBAJ&pg=PA220 p. 220].
= Sieves =
File:Sieve of Eratosthenes animation.gif starts with all numbers unmarked (gray). It repeatedly finds the first unmarked number, marks it as prime (dark colors) and marks its square and all later multiples as composite (lighter colors). After marking the multiples of 2 (red), 3 (green), 5 (blue), and 7 (yellow), all primes up to the square root of the table size have been processed, and all remaining unmarked numbers (11, 13, etc.) are marked as primes (magenta).|alt=Animation of the sieve of Eratosthenes]]
{{main|Sieve of Eratosthenes}}
Before computers, mathematical tables listing all of the primes or prime factorizations up to a given limit were commonly printed.{{cite journal| first=Maarten |last=Bullynck |title=A history of factor tables with notes on the birth of number theory 1657–1817 |journal=Revue d'Histoire des Mathématiques |year=2010 |pages=133–216 |volume=16 |issue=2 |url=https://hal-univ-paris8.archives-ouvertes.fr/hal-01103903/ }} The oldest known method for generating a list of primes is called the sieve of Eratosthenes.{{cite book |title=The Joy of Factoring |volume=68 |series=Student mathematical library |first=Samuel S. Jr. |last=Wagstaff |author-link=Samuel S. Wagstaff Jr. |publisher=American Mathematical Society |year=2013 |isbn=978-1-4704-1048-3 |page=191 |url=https://books.google.com/books?id=rowCAQAAQBAJ&pg=PA191 }} The animation shows an optimized variant of this method.{{cite book |title=Prime Numbers: A Computational Perspective |edition=2nd |first1=Richard |last1=Crandall |author1-link=Richard Crandall |first2=Carl |last2=Pomerance |author2-link=Carl Pomerance |publisher=Springer |year=2005 |isbn=978-0-387-25282-7 |page=121 |url=https://books.google.com/books?id=RbEz-_D7sAUC&pg=PA121 }} Another more asymptotically efficient sieving method for the same problem is the sieve of Atkin.{{cite conference | last1 = Farach-Colton | first1 = Martín | author1-link = Martin Farach-Colton | last2 = Tsai | first2 = Meng-Tsung | editor1-last = Elbassioni | editor1-first = Khaled | editor2-last = Makino | editor2-first = Kazuhisa | arxiv = 1504.05240 | contribution = On the complexity of computing prime tables | doi = 10.1007/978-3-662-48971-0_57 | pages = 677–688 | publisher = Springer | series = Lecture Notes in Computer Science | title = Algorithms and Computation: 26th International Symposium, ISAAC 2015, Nagoya, Japan, December 9-11, 2015, Proceedings | volume = 9472 | year = 2015| isbn = 978-3-662-48970-3 }} In advanced mathematics, sieve theory applies similar methods to other problems.{{cite book|title=Sieves in Number Theory|volume=43|series=Ergebnisse der Mathematik und ihrer Grenzgebiete (3. Folge)|first=George|last=Greaves|publisher=Springer|year=2013|isbn=978-3-662-04658-6|page=1|url=https://books.google.com/books?id=G0TtCAAAQBAJ&pg=PA1}}
= Primality testing versus primality proving =
Some of the fastest modern tests for whether an arbitrary given number {{tmath|n}} is prime are probabilistic (or Monte Carlo) algorithms, meaning that they have a small random chance of producing an incorrect answer.{{cite book | last = Hromkovič | first = Juraj | author-link = Juraj Hromkovič | contribution = 5.5 Bibliographic Remarks | contribution-url = https://books.google.com/books?id=nkeqCAAAQBAJ&pg=PA383 | doi = 10.1007/978-3-662-04616-6 | isbn = 978-3-540-66860-2 | mr = 1843669 | pages = 383–385 | publisher = Springer-Verlag, Berlin | series = Texts in Theoretical Computer Science. An EATCS Series | title = Algorithmics for Hard Problems | year = 2001| s2cid = 31159492 }} For instance the Solovay–Strassen primality test on a given number {{tmath|p}} chooses a number {{tmath|a}} randomly from 2 through and uses modular exponentiation to check whether is divisible by {{tmath|p}}.{{efn|In this test, the term is negative if {{tmath|a}} is a square modulo the given (supposed) prime {{tmath|p}}, and positive otherwise. More generally, for non-prime values of {{tmath|p}}, the term is the (negated) Jacobi symbol, which can be calculated using quadratic reciprocity.}} If so, it answers yes and otherwise it answers no. If {{tmath|p}} really is prime, it will always answer yes, but if {{tmath|p}} is composite then it answers yes with probability at most 1/2 and no with probability at least 1/2. If this test is repeated {{tmath|n}} times on the same number, the probability that a composite number could pass the test every time is at most {{tmath|1/2^n}}. Because this decreases exponentially with the number of tests, it provides high confidence (although not certainty) that a number that passes the repeated test is prime. On the other hand, if the test ever fails, then the number is certainly composite.{{cite book | title = Fundamentals of Computer Security | first1 = Josef | last1 = Pieprzyk | first2 = Thomas | last2 = Hardjono | first3 = Jennifer | last3 = Seberry | author3-link = Jennifer Seberry | publisher = Springer | year = 2013 | isbn = 978-3-662-07324-7 | contribution = 2.3.9 Probabilistic Computations | pages = 51–52 | contribution-url = https://books.google.com/books?id=BG2rCAAAQBAJ&pg=PA51}}
A composite number that passes such a test is called a pseudoprime.{{cite book | last = Koblitz | first = Neal | author-link = Neal Koblitz | contribution = Chapter V. Primality and Factoring | doi = 10.1007/978-1-4684-0310-7_5 | isbn = 978-0-387-96576-5 | mr = 910297 | pages = 112–149 | publisher = Springer-Verlag, New York | series = Graduate Texts in Mathematics | title = A Course in Number Theory and Cryptography | volume = 114 | year = 1987}}
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,{{cite book | last = Tao | first = Terence | author-link = Terence Tao | contribution = 1.11 The AKS primality test | contribution-url = https://terrytao.wordpress.com/2009/08/11/the-aks-primality-test/ | doi = 10.1090/gsm/117 | isbn = 978-0-8218-5280-4 | location = Providence, RI | mr = 2780010 | pages = 82–86 | publisher = American Mathematical Society | title = An epsilon of room, II: Pages from year three of a mathematical blog | volume = 117 | year = 2010| series = Graduate Studies in Mathematics }}
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.{{efn|Indeed, much of the analysis of elliptic curve primality proving is based on the assumption that the input to the algorithm has already passed a probabilistic test.{{cite journal | last1 = Atkin | first1 = A O.L. | author1-link = A. O. L. Atkin | last2 = Morain | first2 = F. | doi = 10.1090/s0025-5718-1993-1199989-x| issue = 203 | journal = Mathematics of Computation | mr = 1199989 | pages = 29–68 | title = Elliptic curves and primality proving | volume = 61 | year = 1993| jstor = 2152935 | bibcode = 1993MaCom..61...29A |url = https://www.ams.org/mcom/1993-61-203/S0025-5718-1993-1199989-X/S0025-5718-1993-1199989-X.pdf | doi-access = free }}}}
The following table lists some of these tests. Their running time is given in terms of {{tmath|n}}, the number to be tested and, for probabilistic algorithms, the number {{tmath|k}} of tests performed. Moreover, is an arbitrarily small positive number, and log is the logarithm to an unspecified base. The big O notation means that each time bound should be multiplied by a constant factor to convert it from dimensionless units to units of time; this factor depends on implementation details such as the type of computer used to run the algorithm, but not on the input parameters {{tmath|n}} and {{tmath|k}}.
= Special-purpose algorithms and the largest known prime =
{{Further|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.{{cite book | last = Tao | first = Terence | author-link = Terence Tao | contribution = 1.7 The Lucas–Lehmer test for Mersenne primes | contribution-url = https://terrytao.wordpress.com/2008/10/02/the-lucas-lehmer-test-for-mersenne-primes/ | isbn = 978-0-8218-4883-8 | location = Providence, RI | mr = 2523047 | pages = 36–41 | publisher = American Mathematical Society | title = Poincaré's legacies, pages from year two of a mathematical blog. Part I | year = 2009 }} This is why since 1992 ({{as of|2024|10|lc=y}}) the largest known prime has always been a Mersenne prime.{{harvnb|Kraft|Washington|2014}}, [https://books.google.com/books?id=4NAqBgAAQBAJ&pg=PA41 p. 41]. It is conjectured that there are infinitely many Mersenne primes.For instance see {{harvnb|Guy|2013}}, [https://books.google.com/books?id=1BnoBwAAQBAJ&pg=PA13 A3 Mersenne primes. Repunits. Fermat numbers. Primes of shape {{tmath| k\cdot 2^n+1 }}. pp. 13–21].
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.{{cite web | url= https://www.eff.org/press/archives/2009/10/14-0 | title= Record 12-Million-Digit Prime Number Nets $100,000 Prize | date= October 14, 2009 | publisher= Electronic Frontier Foundation | access-date= 2010-01-04 }} The Electronic Frontier Foundation also offers $150,000 and $250,000 for primes with at least 100 million digits and 1 billion digits, respectively.{{cite web | url= https://www.eff.org/awards/coop | title= EFF Cooperative Computing Awards | date= 2008-02-29| publisher= Electronic Frontier Foundation | access-date= 2010-01-04 }}
= Integer factorization =
{{main|Integer factorization}}
Given a composite integer {{tmath|n}}, the task of providing one (or all) prime factors is referred to as factorization of {{tmath|n}}. It is significantly more difficult than primality testing,{{harvnb|Kraft|Washington|2014}}, [https://books.google.com/books?id=4NAqBgAAQBAJ&pg=PA275 p. 275]. and although many factorization algorithms are known, they are slower than the fastest primality testing methods. Trial division and Pollard's rho algorithm can be used to find very small factors of {{tmath|n}}, and elliptic curve factorization can be effective when {{tmath|n}} has factors of moderate size.{{cite book|title=An Introduction to Mathematical Cryptography|series=Undergraduate Texts in Mathematics|first1=Jeffrey|last1=Hoffstein|first2=Jill|last2=Pipher|author2-link=Jill Pipher|first3=Joseph H.|last3=Silverman|author3-link=Joseph H. Silverman|edition=2nd|publisher=Springer|year=2014|isbn=978-1-4939-1711-2|page=329|url=https://books.google.com/books?id=cbl_BAAAQBAJ&pg=PA329}} Methods suitable for arbitrary large numbers that do not depend on the size of its factors include the quadratic sieve and general number field sieve. As with primality testing, there are also factorization algorithms that require their input to have a special form, including the special number field sieve.{{cite journal | last = Pomerance | first = Carl | author-link = Carl Pomerance | issue = 12 | journal = Notices of the American Mathematical Society | mr = 1416721 | pages = 1473–1485 | title = A tale of two sieves | volume = 43 | year = 1996}} {{as of|2019|12}} the largest number known to have been factored by a general-purpose algorithm is RSA-240, which has 240 decimal digits (795 bits) and is the product of two large primes.{{cite web |first1=Emmanuel |last1=Thomé |url=https://listserv.nodak.edu/cgi-bin/wa.exe?A2=NMBRTHRY;fd743373.1912 |title=795-bit factoring and discrete logarithms |date= December 2, 2019 |website=LISTSERV Archives }}
Shor's algorithm can factor any integer in a polynomial number of steps on a quantum computer.{{cite book|title=Quantum Computing: A Gentle Introduction|first1=Eleanor G.|last1=Rieffel|author1-link=Eleanor Rieffel|first2=Wolfgang H.|last2=Polak|publisher=MIT Press|year=2011|isbn=978-0-262-01506-6|contribution=Chapter 8. Shor's Algorithm|pages=163–176|title-link= Quantum Computing: A Gentle Introduction |contribution-url=https://books.google.com/books?id=iYX6AQAAQBAJ&pg=PA163}} However, current technology can only run this algorithm for very small numbers. {{As of|2012|10}}, the largest number that has been factored by a quantum computer running Shor's algorithm is 21.{{cite journal |last1=Martín-López |first1=Enrique |first2=Anthony|last2=Laing|first3=Thomas|last3=Lawson |first4=Roberto|last4=Alvarez |first5=Xiao-Qi|last5=Zhou |first6=Jeremy L.|last6=O'Brien |title=Experimental realization of Shor's quantum factoring algorithm using qubit recycling |journal=Nature Photonics |volume=6 |issue=11 |pages=773–776 |date=12 October 2012 |doi=10.1038/nphoton.2012.259 |arxiv = 1111.4147 |bibcode = 2012NaPho...6..773M |s2cid=46546101 }}
= Other computational applications =
Several public-key cryptography algorithms, such as RSA and the Diffie–Hellman key exchange, are based on large prime numbers (2048-bit primes are common).{{cite news|newspaper=The Register|url=https://www.theregister.co.uk/2016/10/09/crypto_needs_more_transparency_researchers_warn/|title=Crypto needs more transparency, researchers warn|first=Richard|last=Chirgwin|date=October 9, 2016}} RSA relies on the assumption that it is much easier (that is, more efficient) to perform the multiplication of two (large) numbers {{tmath|x}} and {{tmath|y}} than to calculate {{tmath|x}} and {{tmath|y}} (assumed coprime) if only the product is known. The Diffie–Hellman key exchange relies on the fact that there are efficient algorithms for modular exponentiation (computing {{tmath|a^b\bmod{c} }}), while the reverse operation (the discrete logarithm) is thought to be a hard problem.{{harvnb|Hoffstein|Pipher|Silverman|2014}}, Section 2.3, Diffie–Hellman key exchange, pp. 65–67.
Prime numbers are frequently used for hash tables. For instance the original method of Carter and Wegman for universal hashing was based on computing hash functions by choosing random linear functions modulo large prime numbers. Carter and Wegman generalized this method to k-independent hashing by using higher-degree polynomials, again modulo large primes.{{Introduction to Algorithms|edition=2|chapter=11.3 Universal hashing|pages=232–236}} For {{tmath|k}}-independent hashing see problem 11–4, p. 251. For the credit to Carter and Wegman, see the chapter notes, p. 252. As well as in the hash function, prime numbers are used for the hash table size in quadratic probing based hash tables to ensure that the probe sequence covers the whole table.{{cite book|title=Data Structures & Algorithms in Java|edition=4th|first1=Michael T.|last1=Goodrich|author1-link=Michael T. Goodrich|first2=Roberto|last2=Tamassia|author2-link=Roberto Tamassia|publisher=John Wiley & Sons|year=2006|isbn=978-0-471-73884-8}} See "Quadratic probing", p. 382, and exercise C–9.9, p. 415.
Some checksum methods are based on the mathematics of prime numbers. For instance the checksums used in International Standard Book Numbers are defined by taking the rest of the number modulo 11, a prime number. Because 11 is prime this method can detect both single-digit errors and transpositions of adjacent digits.{{cite book|title=Identification Numbers and Check Digit Schemes|volume=18|series=Classroom Resource Materials|first=Joseph|last=Kirtland|author-link=Joseph Kirtland|publisher=Mathematical Association of America|year=2001|isbn=978-0-88385-720-5|pages=43–44|url=https://books.google.com/books?id=Z8eka35WUb8C&pg=PA43}} Another checksum method, Adler-32, uses arithmetic modulo 65521, the largest prime number less than {{tmath|2^{16} }}.{{cite IETF |rfc=1950|title=ZLIB Compressed Data Format Specification version 3.3|last=Deutsch|first=P.|publisher=Network Working Group|date=May 1996}} Prime numbers are also used in pseudorandom number generators including linear congruential generators{{cite book|title=The Art of Computer Programming, Vol. 2: Seminumerical algorithms|edition=3rd|first=Donald E.|last=Knuth|author-link=Donald Knuth|publisher=Addison-Wesley|year=1998|contribution=3.2.1 The linear congruential model|pages=10–26|isbn=978-0-201-89684-8|title-link=The Art of Computer Programming}} and the Mersenne Twister.{{cite journal | last1 = Matsumoto | first1 = Makoto | last2 = Nishimura | first2 = Takuji | doi = 10.1145/272991.272995 | issue = 1 | journal = ACM Transactions on Modeling and Computer Simulation | pages = 3–30 | title = Mersenne Twister: A 623-dimensionally equidistributed uniform pseudo-random number generator | volume = 8 | year = 1998| citeseerx = 10.1.1.215.1141 | s2cid = 3332028 }}
Other 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. 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.{{cite journal |last=Roth |first=Klaus F. |author-link=Klaus Roth |year=1951 |title=On a problem of Heilbronn |journal=Journal of the London Mathematical Society |series=Second Series |volume=26 |issue=3 |pages=198–204 |doi=10.1112/jlms/s1-26.3.198 |mr=0041889}} 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.{{cite journal | first = David A. | last = Cox | author-link = David A. Cox | title = Why Eisenstein proved the Eisenstein criterion and why Schönemann discovered it first | journal = American Mathematical Monthly | volume = 118 | issue = 1 | year = 2011 | pages = 3–31 | doi = 10.4169/amer.math.monthly.118.01.003 | url = https://www.maa.org/sites/default/files/pdf/upload_library/22/Ford/Cox-2012.pdf | citeseerx = 10.1.1.398.3440 | s2cid = 15978494 | access-date = 2018-01-25 | archive-date = 2023-03-26 | archive-url = https://web.archive.org/web/20230326032030/https://www.maa.org/sites/default/files/pdf/upload_library/22/Ford/Cox-2012.pdf | url-status = dead }}
The concept of a 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.{{cite book |last1=Lang |first1=Serge |author1-link=Serge Lang |title=Algebra |publisher=Springer-Verlag |year=2002 |isbn=978-0-387-95385-4 |series=Graduate Texts in Mathematics |volume=211 |location=Berlin, Germany; New York |doi=10.1007/978-1-4613-0041-0 |mr=1878556}} Section II.1, p. 90. 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. 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. Any knot can be uniquely expressed as a connected sum of prime knots.{{cite journal|last=Schubert|first= Horst|title=Die eindeutige Zerlegbarkeit eines Knotens in Primknoten|journal=S.-B Heidelberger Akad. Wiss. Math.-Nat. Kl.|year=1949|volume=1949|issue=3|pages=57–104|mr=0031733}} The prime decomposition of 3-manifolds is another example of this type.{{cite journal | last = Milnor | first = J. | author-link = John Milnor | doi = 10.2307/2372800 | journal = American Journal of Mathematics | mr = 0142125 | pages = 1–7 | title = A unique decomposition theorem for 3-manifolds | volume = 84 | issue = 1 | year = 1962| jstor = 2372800 }}
Beyond mathematics and computing, prime numbers have potential connections to quantum mechanics, and have been used metaphorically in the arts and literature. They have also been used in evolutionary biology to explain the life cycles of cicadas.
= Constructible polygons and polygon partitions =
File:Pentagon construct.gif.|alt=Construction of a regular pentagon using straightedge and compass]]
Fermat primes are primes of the form
:
with {{tmath|k}} a nonnegative integer.{{harvtxt|Boklan|Conway|2017}} also include {{tmath|1= 2^0+1=2 }}, which is not of this form. They are named after Pierre de Fermat, who conjectured that all such numbers are prime. The first five of these numbers – 3, 5, 17, 257, and 65,537 – are prime,{{cite book | last1 = Křížek | first1 = Michal | last2 = Luca | first2 = Florian | last3 = Somer | first3 = Lawrence | doi = 10.1007/978-0-387-21850-2 | isbn =978-0-387-95332-8 | location = New York | mr = 1866957 | pages = 1–2 | publisher = Springer-Verlag | series = CMS Books in Mathematics | title = 17 Lectures on Fermat Numbers: From Number Theory to Geometry | url = https://books.google.com/books?id=hgfSBwAAQBAJ&pg=PA1 | volume = 9 | year = 2001}} but is composite and so are all other Fermat numbers that have been verified as of 2017.{{cite journal | last1 = Boklan | first1 = Kent D. | last2 = Conway | first2 = John H. | author2-link = John Horton Conway | arxiv = 1605.01371 | date = January 2017 | doi = 10.1007/s00283-016-9644-3 | issue = 1 | journal = The Mathematical Intelligencer | pages = 3–5 | title = Expect at most one billionth of a new Fermat prime! | volume = 39 | s2cid = 119165671 }} A regular polygon is constructible using straightedge and compass if and only if the odd prime factors of {{tmath|n}} (if any) are distinct Fermat primes. Likewise, a regular {{tmath|n}}-gon may be constructed using straightedge, compass, and an angle trisector if and only if the prime factors of regular polygon are any number of copies of 2 or 3 together with a (possibly empty) set of distinct Pierpont primes, primes of the form {{tmath|2^a3^b+1}}.{{cite journal | last = Gleason | first = Andrew M. | author-link = Andrew M. Gleason | doi = 10.2307/2323624 | issue = 3 | journal = American Mathematical Monthly | mr = 935432 | pages = 185–194 | title = Angle trisection, the heptagon, and the triskaidecagon | volume = 95 | year = 1988| jstor = 2323624 }}
It is possible to partition any convex polygon into {{tmath|n}} smaller convex polygons of equal area and equal perimeter, when {{tmath|n}} is a power of a prime number, but this is not known for other values of {{tmath|n}}.{{cite journal | last = Ziegler | first = Günter M. | author-link = Günter M. Ziegler | issue = 95 | journal = European Mathematical Society Newsletter | mr = 3330472 | pages = 25–31 | title = Cannons at sparrows | year = 2015}}
= Quantum mechanics =
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.{{cite web|first=Ivars|last=Peterson|author-link=Ivars Peterson |work=MAA Online |url=http://www.maa.org/mathland/mathtrek_6_28_99.html |title=The Return of Zeta |date=June 28, 1999 |access-date=2008-03-14 |url-status=dead |archive-url=https://web.archive.org/web/20071020141624/http://maa.org/mathland/mathtrek_6_28_99.html |archive-date=October 20, 2007 }}{{Cite journal|last=Hayes|first=Brian|author-link=Brian Hayes (scientist)|date=2003|title=Computing science: The spectrum of Riemannium|jstor=27858239|journal=American Scientist|volume=91|issue=4|pages=296–300|doi=10.1511/2003.26.3349|s2cid=16785858 }} 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.{{cite book |title=Geometry of quantum states: an introduction to quantum entanglement |title-link=Geometry of Quantum States |last1=Bengtsson |first1=Ingemar |last2=Życzkowski |first2=Karol |publisher=Cambridge University Press |year=2017 |isbn=978-1-107-02625-4 |edition=Second |location=Cambridge |pages=313–354 |oclc=967938939 |author-link2=Karol Życzkowski }}{{cite journal |last=Zhu |first=Huangjun |title=SIC POVMs and Clifford groups in prime dimensions |url=http://stacks.iop.org/1751-8121/43/i=30/a=305305?key=crossref.45cb006b9f3c7e510461594ea8dfa7f7 |journal=Journal of Physics A: Mathematical and Theoretical |volume=43 |issue=30 |pages=305305 |arxiv=1003.3591 |doi=10.1088/1751-8113/43/30/305305 |bibcode=2010JPhA...43D5305Z |year=2010 |s2cid=118363843 }}
= Biology =
The evolutionary strategy used by cicadas of the genus Magicicada makes use of prime numbers.{{cite journal |last1=Goles |first1=E. |last2=Schulz |first2=O. |first3=M. |last3=Markus |year=2001 |title=Prime number selection of cycles in a predator-prey model |journal=Complexity |volume=6 |issue=4 |pages=33–38 |doi=10.1002/cplx.1040 |bibcode=2001Cmplx...6d..33G }} 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.{{cite journal |last1=Campos |first1=Paulo R. A. |last2=de Oliveira |first2=Viviane M. |last3=Giro |first3=Ronaldo |last4=Galvão |first4=Douglas S. |year=2004 |title=Emergence of prime numbers as the result of evolutionary strategy |journal=Physical Review Letters |volume=93 |issue=9 |page=098107 |arxiv=q-bio/0406017 |bibcode=2004PhRvL..93i8107C |doi=10.1103/PhysRevLett.93.098107 |pmid=15447148 |s2cid=88332}}{{cite news |newspaper=The Economist| url=http://economist.com/PrinterFriendly.cfm?Story_ID=2647052 |title=Invasion of the Brood |date=May 6, 2004|access-date=2006-11-26 }} 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.{{cite magazine|last1=Zimmer|first1=Carl|author-link=Carl Zimmer|date=May 15, 2015|title=Bamboo Mathematicians|url=https://www.nationalgeographic.com/science/article/bamboo-mathematicians|department=Phenomena: The Loom|magazine=National Geographic|access-date=February 22, 2018}}
= Arts and literature =
Prime numbers have influenced many artists and writers. The French composer Olivier Messiaen used prime numbers to create ametrical music through "natural phenomena". In works such as La Nativité du Seigneur (1935) and Quatre études de rythme (1949–1950), 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".{{cite book | editor1-last=Hill | editor1-first=Peter Jensen | title=The Messiaen companion | publisher=Amadeus Press | location=Portland, OR | isbn=978-0-931340-95-6 | year=1995 | url = https://books.google.com/books?id=7ag3ymWqvfgC&pg=PT225 | at = Ex. 13.2 Messe de la Pentecôte 1 'Entrée'}}
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.{{cite book | last = Pomerance | first = Carl | author-link = Carl Pomerance | editor1-last = Hayes | editor1-first = David F. | editor2-last = Ross | editor2-first = Peter | contribution = Prime Numbers and the Search for Extraterrestrial Intelligence | contribution-url = https://gauss.dartmouth.edu/~carlp/PDF/extraterrestrial.pdf | isbn = 978-0-88385-548-5 | location = Washington, DC | mr = 2085842 | pages = 3–6 | publisher = Mathematical Association of America | series = MAA Spectrum | title = Mathematical Adventures for Students and Amateurs | year = 2004}} 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.{{cite news|url=https://www.theguardian.com/science/punctuated-equilibrium/2010/sep/16/curious-incident-dog-night-time|title=The Curious Incident of the Dog in the Night-Time|author=GrrlScientist|date=September 16, 2010|newspaper=The Guardian|access-date=February 22, 2010|department=Science}} 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.{{cite news|newspaper=The New York Times|title=Counting on Each Other|first=Liesl|last=Schillinger|date=April 9, 2010|url=https://www.nytimes.com/2010/04/11/books/review/Schillinger-t.html|department=Sunday Book Review}}
Notes
{{notelist}}
References
{{reflist}}
External links
{{Sister project links|commons=Category:Prime numbers}}
- {{SpringerEOM|title=Prime number|id=p/p074530|mode=cs1}}
- Caldwell, Chris, The Prime Pages at [http://primes.utm.edu/ primes.utm.edu].
- {{In Our Time|Prime Numbers|p003hyf5}}.
- "[http://plus.maths.org/issue49/package/index.html Teacher package: Prime numbers]" from Plus, December 1, 2008, produced by the Millennium Mathematics Project at the University of Cambridge.
= Generators and calculators =
- [http://www.javascripter.net/math/calculators/primefactorscalculator.htm Prime factors calculator] can factorize any positive integer up to 20 digits.
- [http://www.alpertron.com.ar/ECM.HTM Fast Online primality test with factorization] makes use of the Elliptic Curve Method (up to thousand-digits numbers, requires Java).
- [http://www.bigprimes.net/ Huge database of prime numbers].
- [http://www.primos.mat.br/indexen.html Prime Numbers up to 1 trillion]. {{Webarchive|url=https://web.archive.org/web/20210227001026/http://www.primos.mat.br/indexen.html |date=2021-02-27 }}.
{{Authority control}}
{{Number theory}}
{{Divisor classes}}
{{Prime number classes}}
{{Classes of natural numbers}}
{{Portal bar|Mathematics|Science|History of science|Arithmetic}}