Loading AI tools

Number divisible only by 1 or itself From Wikipedia, the free encyclopedia

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, 1 × 5 or 5 × 1, involve 5 itself. However, 4 is composite because it is a product (2 × 2) in which both numbers are smaller than 4. Primes are central in number theory because of the fundamental theorem of arithmetic: every natural number greater than 1 is either a prime itself or can be factorized as a product of primes that is unique up to their order.

The property of being prime is called **primality**. A simple but slow method of checking the primality of a given number , called trial division, tests whether is a multiple of any integer between 2 and . 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 December 2018^{[update]} the largest known prime number is a Mersenne prime with 24,862,048 decimal digits.^{[1]}

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

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.^{[2]} In other words, is prime if items cannot be divided up into smaller equal-size groups of more than one item,^{[3]} or if it is not possible to arrange dots into a rectangular grid that is more than one dot wide and more than one dot high.^{[4]} For example, among the numbers 1 through 6, the numbers 2, 3, and 5 are the prime numbers,^{[5]} 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. 4 = 2 × 2 and 6 = 2 × 3 are both composite.

The divisors of a natural number are the natural numbers that divide 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.^{[6]} Yet another way to express the same thing is that a number is prime if it is greater than one and if none of the numbers divides evenly.^{[7]}

The first 25 prime numbers (all the prime numbers less than 100) are:^{[8]}

- 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 (sequence A000040 in the OEIS).

No even number greater than 2 is prime because any such number can be expressed as the product . Therefore, every prime number other than 2 is an odd number, and is called an *odd prime*.^{[9]} 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.^{[10]}

The set of all primes is sometimes denoted by (a boldface capital P)^{[11]} or by (a blackboard bold capital P).^{[12]}

The Rhind Mathematical Papyrus, from around 1550 BC, has Egyptian fraction expansions of different forms for prime and composite numbers.^{[13]} However, the earliest surviving records of the study of prime numbers come from the ancient Greek mathematicians, who called them *prōtos arithmòs* (πρῶτος ἀριθμὸς). 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.^{[14]} Another Greek invention, the Sieve of Eratosthenes, is still used to construct lists of primes.^{[15]}^{[16]}

Around 1000 AD, the Islamic mathematician Ibn al-Haytham (Alhazen) found Wilson's theorem, characterizing the prime numbers as the numbers that evenly divide . He also conjectured that all even perfect numbers come from Euclid's construction using Mersenne primes, but was unable to prove it.^{[17]} 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.^{[16]} 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.^{[16]}

In 1640 Pierre de Fermat stated (without proof) Fermat's little theorem (later proved by Leibniz and Euler).^{[18]} Fermat also investigated the primality of the Fermat numbers ,^{[19]} and Marin Mersenne studied the Mersenne primes, prime numbers of the form with itself a prime.^{[20]} Christian Goldbach formulated Goldbach's conjecture, that every even number is the sum of two primes, in a 1742 letter to Euler.^{[21]} Euler proved Alhazen's conjecture (now the Euclid–Euler theorem) that all even perfect numbers can be constructed from Mersenne primes.^{[14]} 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 .^{[22]} At the start of the 19th century, Legendre and Gauss conjectured that as tends to infinity, the number of primes up to is asymptotic to , where is the natural logarithm of . A weaker consequence of this high density of primes was Bertrand's postulate, that for every there is a prime between and , proved in 1852 by Pafnuty Chebyshev.^{[23]} 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.^{[24]} Another important 19th century result was Dirichlet's theorem on arithmetic progressions, that certain arithmetic progressions contain infinitely many primes.^{[25]}

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),^{[26]} Proth's theorem (c. 1878),^{[27]} the Lucas–Lehmer primality test (originated 1856), and the generalized Lucas primality test.^{[16]}

Since 1951 all the largest known primes have been found using these tests on computers.^{[lower-alpha 1]} The search for ever larger primes has generated interest outside mathematical circles, through the Great Internet Mersenne Prime Search and other distributed computing projects.^{[8]}^{[29]} The idea that prime numbers had few applications outside of pure mathematics^{[lower-alpha 2]} was shattered in the 1970s when public-key cryptography and the RSA cryptosystem were invented, using prime numbers as their basis.^{[32]}

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.^{[15]}^{[33]}^{[34]} 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.^{[35]}

Most early Greeks did not even consider 1 to be a number,^{[36]}^{[37]} 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 2 to be prime either. However, Euclid and a majority of the other Greek mathematicians considered 2 as prime. The medieval Islamic mathematicians largely followed the Greeks in viewing 1 as not being a number.^{[36]} By the Middle Ages and Renaissance, mathematicians began treating 1 as a number, and some of them included it as the first prime number.^{[38]} In the mid-18th century, Christian Goldbach listed 1 as prime in his correspondence with Leonhard Euler;^{[39]} however, Euler himself did not consider 1 to be prime.^{[40]} Many 19th century mathematicians still considered 1 to be prime,^{[41]} and Derrick Norman Lehmer included 1 in his *list of primes less than ten million* published in 1914.^{[42]} Lists of primes that included 1 continued to be published as recently as 1956.^{[43]}^{[44]} However, around this time, by the early 20th century, mathematicians started to agree that 1 should not be classified as a prime number.^{[41]}

If 1 is 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.^{[41]} 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.^{[44]} 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.^{[45]} 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".^{[41]}