# Prime number/Citable Version  Main Article Discussion Related Articles  [?] Bibliography  [?] External Links  [?] Citable Version  [?] This version approved either by the Approvals Committee, or an Editor from the listed workgroup. The Mathematics Workgroup is responsible for this citable version. While we have done conscientious work, we cannot guarantee that this version is wholly free of mistakes. See here (not History) for authorship. Help improve this work further on the editable Main Article! The prime number 11 illustrated with square tiles. 12 squares can be arranged into a rectangle with sides of length 3 and 4, so 12 is not a prime number. There is no way to form a full rectangle more than one square wide with 11 squares, so 11 is a prime number.

A prime number is a number that can be evenly divided by exactly two positive whole numbers, namely 1 and itself. The first few prime numbers are 2, 3, 5, 7, 11, 13, and 17. A prime number $p$ cannot be factored as the product of two numbers $p=a\times b,$ except for the trivial factorizations $p=1\times p=p\times 1$ that all numbers possess.

With the exception of 2, all prime numbers are odd numbers, but not every odd number is prime. For example, $9=3\times 3$ and $15=3\times 5,$ so neither 9 nor 15 is prime. By the strict mathematical definition, the number 1 is not considered to be prime (although this is a matter of definition, and mathematicians in the past often did consider 1 to be a prime).

The importance of prime numbers in arithmetic comes in large part from the unique factorization of numbers. Every number $N>1$ can be written as a product of prime factors, and any two such expressions for $N$ will differ only in the order of the factors. For example, we can write $5040=7\times 5\times 3\times 3\times 2\times 2\times 2\times 2$ , where all of the factors in the product are prime numbers; there is no other way of writing 5040 as a product of prime numbers except by rearranging the prime factors we already have, such as $5040=2\times 3\times 2\times 7\times 2\times 3\times 2\times 5$ . Because of the unique factorization of numbers into prime numbers, an analogy can be made between the role prime numbers play in arithmetic and the role atoms play in chemistry.

The study of prime numbers has a long history, going back to ancient times, and it remains an active part of number theory today. Although the study of prime numbers used to be an interesting but not terribly useful area of mathematical research, today it has important applications. Understanding properties of prime numbers and their generalizations is essential to modern cryptography—in particular to public key ciphers that are crucial to Internet commerce, wireless networks, and military applications. Less well-known is that other computer algorithms also depend on properties of prime numbers.

## There are infinitely many primes

One basic fact about the prime numbers is that there are infinitely many of them. In other words, the list of prime numbers 2, 3, 5, 7, 11, 13, 17, ... never stops. There are a number of ways of showing that there are infinitely many primes, but one of the oldest and most familiar proofs goes back go Euclid.

Euclid proved that for any finite set of prime numbers, there is always another prime number which is not in that set. Choose any finite set of prime numbers $\{p_{1},p_{2},p_{3},\ldots ,p_{n}\}$ . Then the number

$N=p_{1}p_{2}\cdots p_{n}+1$ presents a problem. On the one hand, the number $N-1=p_{1}p_{2}\cdots p_{n}$ is a multiple of $p_{1}$ , and multiples of the same prime number are never next to each other, so N itself can't be a multiple of $p_{1}$ . The same argument actually shows that $N$ itself cannot be a multiple of any of the prime numbers $p_{1},p_{2},p_{3},\dots ,p_{n}$ . On the other hand, every number $N>1$ is divisible by some prime. (For example, its smallest divisor greater than 1 must be a prime.)

This shows that there is at least one prime number (namely, the smallest divisor of N greater than 1) that is excluded from our initial finite set. Since any finite set of prime numbers can thus be extended to a larger finite set of prime numbers, we conclude that there are infinitely many prime numbers.

Although most other proofs of the infinitude of prime numbers are more complicated, they can also provide more information. One mathematical milestone known as the Prime Number Theorem estimates how many of the numbers between 1 and x are prime numbers (see below). Another such proof is Euler's demonstration that the sum of the reciprocals of the primes diverges to ∞.

## Locating primes

How can we tell which numbers are prime and which are not? It is sometimes possible to tell that a number is not prime by looking at its digits: for example, any number whose last digit is even is divisble by 2, and any number ending with 5 or 0 is divisible by 5. Therefore, except for the prime numbers 2 and 5, any prime number must end with the digit 1, 3, 7, or 9. This check can be used to rule out the possibility of a randomly chosen number being prime more than half of the time, but numbers that end with 1, 3, 7, or 9 often have divisors that are harder to spot.

To find large prime numbers, we must use a systematic procedure — an algorithm. Nowadays, prime-finding calculations are performed by computers, often using very complicated algorithms, but there are simple algorithms that can be carried out by hand if the numbers are small. In fact, the simplest methods for locating prime numbers are some of the oldest algorithms, known since antiquity. Two classical algorithms are called trial division and the sieve of Eratosthenes.

### Trial division

Trial division consists of systematically searching the list of numbers $2,3,\dots ,n-1$ for a divisor; if none is found, the number is prime. If n has a small divisor, we can quit as soon as we've found it, but in the worst case — if n is prime — we have to test all $n-2$ numbers to be sure. This algorithm can be improved by realizing the following: if n has a divisor a that is larger than ${\sqrt {n}}$ , there must be another divisor b that is smaller than ${\sqrt {n}}$ . Thus, it is sufficient to look for a divisor up to ${\sqrt {n}}$ . This makes a significant difference: for example, we only need to try dividing by 2, 3, ..., 31 to verify that 997 is prime, rather than all the numbers 2, 3, ..., 996. Trial division might be described as follows using pseudocode:

Algorithm: trial division

Given $n$ ,
For each $i$ = 2, 3, ... less than or equal to ${\sqrt {n}}$ :
If $i$ divides $n$ :
Return "$n$ is not prime"
Else:
Continue with the next $i$ When all $i$ have been checked:
Return "$n$ is prime"

### Sieve of Eratosthenes

The Sieve of Eratosthenes not only provides a method for testing a number to see if it is prime, but also for enumerating the (infinite) set of prime numbers. The idea of the method to write down a list of numbers starting from 2 ranging up to some limit, say:

2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

The first number (2) is prime, so we mark it, and cross out all of its multiples:

2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

The smallest unmarked number is 3, so we mark it and cross out all its multiples (some of which may already have been crossed out):

2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

The smallest unmarked number (5) is the next prime, so we mark it and cross out all of its multiples:

2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

Notice that there are no multiples of 5 $(\leq 20)$ that have not already been crossed out, but that doesn't matter at this stage. Proceeding as before, we add 7, 11, 13, 17 and 19 to our list of primes:

2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

We have now found all prime numbers up to 20.

## Distribution of prime numbers

It is evident that the prime numbers are randomly distributed but, unfortunately, we don't know what 'random' means. - R. C. Vaughan

The list of prime numbers suggests that they thin out the further you go: 44% of the one-digit numbers are prime, but only 23% of the two-digit numbers and 16% of the three-digit numbers. The trial division method explained above provides an intuitive explanation. To test whether a number $n$ is prime, you have to try whether it can be divided by all numbers between 2 and ${\sqrt {n}}$ . Large numbers have to undergo more tests, so fewer of them will be prime.

The Prime Number Theorem explains how fast the prime numbers thin out. It says that if you are looking around the number $n$ , about one in every $\log \,n$ numbers is prime (here, $\log \,n$ denotes the natural logarithm of $n$ ). The formal statement of the prime number theorem is

$\lim _{x\to \infty }{\frac {\pi (x)\log x}{x}}=1$ where $\pi (x)$ is the number of primes $\leq x.$ ## Some unsolved problems

There are many unsolved problems concerning prime numbers. A few such problems (posed as conjectures) are:

### The twin prime conjecture

Twin primes are pairs of prime numbers differing by 2. Examples of twin primes include 5 and 7, 11 and 13, and 41 and 43. The Twin Prime Conjecture states that there are an infinite number of these pairs. It remains unproven.

### The Goldbach conjecture

The Goldbach conjecture is that every even number greater than 2 can be expressed as the sum of two primes. For example, if you choose the even number 48, you can find $48=41+7$ where 41 and 7 are prime numbers.

### Primes of special forms

• It is not known whether there are infinitely many primes of the form $2^{n}-1$ (called Mersenne primes). These primes arise in the study of perfect numbers, and factors of numbers of the form $2^{n}-1$ (sometimes called 'Mersenne numbers') are a fruitful source of large prime numbers.
• It is not known whether there are infinitely many primes of the form $2^{n}+1$ (called 'Fermat primes'). Fermat primes arise in elementary geometry because if $p$ is a Fermat prime, it is possible to construct a regular $p$ -gon with a ruler and compass. In particular, it is possible to construct a regular 17-sided polygon (or 17-gon, for short) with a ruler and compass.
• It is not known whether there are infinitely many primes of the form $n^{2}+1$ .

## Alternative definition

A prime number is usually defined as a positive integer other than 1 that is (evenly) divisible only by 1 and itself.

There is another way of defining prime numbers, and that is that a number is prime if whenever it divides the product of two numbers, it must divide one of those numbers. A nonexample (if you will) is that 4 divides 12 (i.e. is a factor of 12), but 4 does not divide 2 and 4 does not divide 6 even though 12 is 2 times 6. This means that 4 is not a prime number. We may express this second possible definition in mathematical notation as follows: A number $p\in \mathbb {N}$ (natural number) is prime if for any $a,b\in \mathbb {N}$ such that $p|ab$ (read p divides ab), either $p|a$ or $p|b$ .

If the first characterization of prime numbers is taken as the definition, the second is derived from it as a theorem (known as Euclid's lemma), and vice versa. The equivalence of these two definitions (in the integers $\mathbb {Z}$ ) is not immediately obvious. In fact, it is a significant result.

## References and notes

1. The number N has at least one divisor greater than 1, because N is a divisor of itself. Let q denote the smallest divisor of N greater than 1. To see why q must be prime: Any divisor of q is also a divisor of N, and since q is the smallest, then q has no divisors smaller than itself except 1, therefore it is prime.
2. The Euclidean algorithm may be used to show that $\mathbb {Z}$ is a principal ideal domain, and this implies that irreducibles are prime.