# Prime numbers

Version for printing
Prime numbers and their properties were first studied extensively by the ancient Greek mathematicians.

The mathematicians of Pythagoras's school (500 BC to 300 BC) were interested in numbers for their mystical and numerological properties. They understood the idea of primality and were interested in perfect and amicable numbers.
A perfect number is one whose proper divisors sum to the number itself. e.g. The number 6 has proper divisors 1, 2 and 3 and 1 + 2 + 3 = 6, 28 has divisors 1, 2, 4, 7 and 14 and 1 + 2 + 4 + 7 + 14 = 28.
A pair of amicable numbers is a pair like 220 and 284 such that the proper divisors of one number sum to the other and vice versa.
You can see more about these numbers in the History topics article Perfect numbers.

By the time Euclid's Elements appeared in about 300 BC, several important results about primes had been proved. In Book IX of the Elements, Euclid proves that there are infinitely many prime numbers. This is one of the first proofs known which uses the method of contradiction to establish a result. Euclid also gives a proof of the Fundamental Theorem of Arithmetic: Every integer can be written as a product of primes in an essentially unique way.

Euclid also showed that if the number 2n - 1 is prime then the number 2n-1(2n - 1) is a perfect number. The mathematician Euler (much later in 1747) was able to show that all even perfect numbers are of this form. It is not known to this day whether there are any odd perfect numbers.

In about 200 BC the Greek Eratosthenes devised an algorithm for calculating primes called the Sieve of Eratosthenes.

There is then a long gap in the history of prime numbers during what is usually called the Dark Ages.

The next important developments were made by Fermat at the beginning of the 17th Century. He proved a speculation of Albert Girard that every prime number of the form 4 n + 1 can be written in a unique way as the sum of two squares and was able to show how any number could be written as a sum of four squares.
He devised a new method of factorising large numbers which he demonstrated by factorising the number 2027651281 = 44021 × 46061.
He proved what has come to be known as Fermat's Little Theorem (to distinguish it from his so-called Last Theorem).
This states that if p is a prime then for any integer a we have ap = a modulo p.
This proves one half of what has been called the Chinese hypothesis which dates from about 2000 years earlier, that an integer n is prime if and only if the number 2n - 2 is divisible by n. The other half of this is false, since, for example, 2341 - 2 is divisible by 341 even though 341 = 31 × 11 is composite. Fermat's Little Theorem is the basis for many other results in Number Theory and is the basis for methods of checking whether numbers are prime which are still in use on today's electronic computers.

Fermat corresponded with other mathematicians of his day and in particular with the monk Marin Mersenne. In one of his letters to Mersenne he conjectured that the numbers 2n + 1 were always prime if n is a power of 2. He had verified this for n = 1, 2, 4, 8 and 16 and he knew that if n were not a power of 2, the result failed. Numbers of this form are called Fermat numbers and it was not until more than 100 years later that Euler showed that the next case 232 + 1 = 4294967297 is divisible by 641 and so is not prime.

Number of the form 2n - 1 also attracted attention because it is easy to show that if unless n is prime these number must be composite. These are often called Mersenne numbers Mn because Mersenne studied them.

Not all numbers of the form 2n - 1 with n prime are prime. For example 211 - 1 = 2047 = 23 × 89 is composite, though this was first noted as late as 1536.
For many years numbers of this form provided the largest known primes. The number M19 was proved to be prime by Cataldi in 1588 and this was the largest known prime for about 200 years until Euler proved that M31 is prime. This established the record for another century and when Lucas showed that M127 (which is a 39 digit number) is prime that took the record as far as the age of the electronic computer.
In 1952 the Mersenne numbers M521, M607, M1279, M2203 and M2281 were proved to be prime by Robinson using an early computer and the electronic age had begun.

By 2018 a total of 50 Mersenne primes have been found. The largest is M77 232 917 which has 23 249 425 decimal digits.

Euler's work had a great impact on number theory in general and on primes in particular.
He extended Fermat's Little Theorem and introduced the Euler φ-function. As mentioned above he factorised the 5th Fermat Number 232 + 1, he found 60 pairs of the amicable numbers referred to above, and he stated (but was unable to prove) what became known as the Law of Quadratic Reciprocity.

He was the first to realise that number theory could be studied using the tools of analysis and in so-doing founded the subject of Analytic Number Theory. He was able to show that not only is the so-called Harmonic series ∑ (1/n) divergent, but the series

1/2 + 1/3 + 1/5 + 1/7 + 1/11 + ...
formed by summing the reciprocals of the prime numbers, is also divergent. The sum to n terms of the Harmonic series grows roughly like log(n), while the latter series diverges even more slowly like log[ log(n) ]. This means, for example, that summing the reciprocals of all the primes that have been listed, even by the most powerful computers, only gives a sum of about 4, but the series still diverges to ∞.

At first sight the primes seem to be distributed among the integers in rather a haphazard way. For example in the 100 numbers immediately before 10 000 000 there are 9 primes, while in the 100 numbers after there are only 2 primes. However, on a large scale, the way in which the primes are distributed is very regular. Legendre and Gauss both did extensive calculations of the density of primes. Gauss (who was a prodigious calculator) told a friend that whenever he had a spare 15 minutes he would spend it in counting the primes in a 'chiliad' (a range of 1000 numbers). By the end of his life it is estimated that he had counted all the primes up to about 3 million. Both Legendre and Gauss came to the conclusion that for large n the density of primes near n is about 1/log(n). Legendre gave an estimate for π(n) the number of primes ≤ n of

π(n) = n/(log(n) - 1.08366)
while Gauss's estimate is in terms of the logarithmic integral
π(n) = ∫ (1/log(t) dt where the range of integration is 2 to n.

You can see the Legendre estimate and the Gauss estimate and can compare them.

The statement that the density of primes is 1/log(n) is known as the Prime Number Theorem. Attempts to prove it continued throughout the 19th Century with notable progress being made by Chebyshev and Riemann who was able to relate the problem to something called the Riemann Hypothesis: a still unproved result about the zeros in the Complex plane of something called the Riemann zeta-function. The result was eventually proved (using powerful methods in Complex analysis) by Hadamard and de la Vallée Poussin in 1896.

There are still many open questions (some of them dating back hundreds of years) relating to prime numbers.
Some unsolved problems

1. The Twin Primes Conjecture that there are infinitely many pairs of primes only 2 apart.

2. Goldbach's Conjecture (made in a letter by C Goldbach to Euler in 1742) that every even integer greater than 2 can be written as the sum of two primes.

3. Are there infinitely many primes of the form n2 + 1 ?
(Dirichlet proved that every arithmetic progression : {a + bn | n N} with a, b coprime contains infinitely many primes.)

4. Is there always a prime between n2 and (n + 1)2 ?
(The fact that there is always a prime between n and 2n was called Bertrand's conjecture and was proved by Chebyshev.)

5. Are there infinitely many prime Fermat numbers? Indeed, are there any prime Fermat numbers after the fourth one?

6. Is there an arithmetic progression of consecutive primes for any given (finite) length? e.g. 251, 257, 263, 269 has length 4. The largest example known has length 10.

7. Are there infinitely many sets of 3 consecutive primes in arithmetic progression. (True if we omit the word consecutive.)

8. n2 - n + 41 is prime for 0 ≤ n ≤ 40. Are there infinitely many primes of this form? The same question applies to n2 - 79 n + 1601 which is prime for 0 ≤ n ≤ 79.

9. Are there infinitely many primes of the form n# + 1? (where n# is the product of all primes ≤ n.)

10. Are there infinitely many primes of the form n# - 1?

11. Are there infinitely many primes of the form n! + 1?

12. Are there infinitely many primes of the form n! - 1?

13. If p is a prime, is 2p - 1 always square free? i.e. not divisible by the square of a prime.

14. Does the Fibonacci sequence contain an infinite number of primes?

Here are the latest prime records that we know.

The largest known prime (found by GIMPS [Great Internet Mersenne Prime Search] in January 2018) is M77 232 917 which has 23 249 425 decimal digits. It is the 50th known Mersenne prime, though there may be some smaller ones which have not been discovered yet. See the Official announcement

The largest known twin prime pair is 2 996 863 034 895 × 21 290 000 ± 1, with 388 342 decimal digits. It was discovered in September 2016.

The largest known factorial prime (prime of the form n! ± 1) is 208 003! - 1. It is a number of 1 015 843 digits and was announced in 2016.

The largest known primorial prime (prime of the form n# ± 1 where n# is the product of all primes ≤ n) is 1 098 133# + 1. It is a number of 476 311 digits and was announced in 2012.

Article by: J J O'Connor and E F Robertson

References (21 books/articles)

Additional Material in MacTutor
1. A History Topic on Perfect numbers

Other Web sites:

1. You can find out about the Great InterNet Mersenne Prime Search at the GIMPS home page.
2. You can find out about primes at University of Tennessee, USA
3. There is some information about the so-called Bertelsen's number and mistakes in calculating π(n) at Ken Brown's Maths pages
4. Some information about Perfect numbers, etc.

JOC/EFR January 2018