# Prime Numbers

• A prime number is an integer whose only positive divisors are 1 and n. An integer greater than 1 which is not prime is composite.
• Euclid showed that there are infinitely many primes.
• The Prime Number Theorem says that the number of primes less than or equal to a real number x is approximately .
• The Sieve of Eratosthenes finds prime numbers by trial division.

Definition. An integer greater than 1 is prime if its only positive factors are 1 and itself. An integer greater than 1 which is not prime is composite.

Prime numbers are the "building blocks" of the integers. For instance, the Fundamental Theorem of Arithmetic says that every integer greater than 1 can be written uniquely as a product of powers of primes. The next lemma is a key step in the proof of the theorem, and is used in Euclid's proof that there are infinitely many primes.

Lemma. Every integer greater than 1 is divisible by at least one prime.

Proof. I'll prove the result by induction. To begin with, the result is true for , since 2 is prime.

Take , and assume the result is true for all integers greater than 1 but less than n. I want to show that the result holds for n. If n is prime, it's divisible by a prime --- namely itself! So suppose n is composite. Then n has a positive factor a other than 1 and n. Suppose .

If , then since , I get , which is a contradiction. Thus, , and since , I have in fact . Since , I get .

By the induction hypothesis, a has a prime factor p. But and implies , so n has a prime factor as well. This shows that the result is true for all by induction.

The following theorem and its proof occur as Proposition 20 in Book 9 of Euclid's Elements.

Theorem. (Euclid) There are infinitely many prime numbers.

Proof. Suppose on the contrary that there are only finitely many primes , , ..., . Look at

This number is not divisible by any of the primes , , ..., , because it leaves a remainder of 1 when divided by any of them. But the previous lemma says that every number greater than 1 is divisible by a prime. This contradiction implies that there can't be finitely many primes --- that is, there are infinitely many.

If you are trying to factor a number n, you do not need to try dividing by all the numbers from 1 to n: It's enough to go up to . This is the idea of the next lemma.

Lemma. Every composite number has a proper factor less than or equal to its square root.

Proof. Suppose n is composite. I can write , where . If both , then

This contradiction shows that at least one of a, b must be less than or equal to .

In fact, you can adapt the preceding proof to show that a composite number must have a prime factor less than or equal to its square root.

For an arbitrary number that is several hundred digits in length, it may be impossible with current technology to determine whether the number is prime. In fact, many cryptographic systems depend on the difficulty of factoring large numbers.

Example. What primes must you divide 127 by to test whether it is prime? To see whether 127 is prime, I only need to see if it has a prime factor . You can do the arithmetic to verify that 127 isn't divisible by 2, 3, 5, 7, or 11. Hence, it must be prime.

Example. ( The Sieve of Eratosthenes) The sieve is a method for generating a list of primes by hand. Write down the integer beginning with 2. Go through the list, crossing out every integer divisible by 2. Then go through the list, crossing out every integer divisible by 3. Keep going.

Illustrate the first two passes through Sieve of Eratosthenes for the numbers from 1 to 50.

I've illustrated the first two passes below.

By the square root criterion above, I've already found all the primes less than 10, namely 2, 3, 5, and 7. After crossing out all the numbers divisible by 5, I'll have all the primes up to 25. And so on. Of course, more sophisticated sieve methods are used in practice.

I showed above that there are infinitely many primes. How are they distributed? That is, are they evenly distributed, or do they get "sparser" as you look at bigger and bigger integers? The Prime Number Theorem gives an aymptotic estimate for , the number of primes less than or equal to x. It says:

Here are the graphs of and .

The graph of is on top and the graph of is on the bottom.

The Prime Number Theorem was first conjectured by Legendre and Gauss. The first rigorous proofs were given by Hadamard and de la Vallee Poussin around 1896. Elementary proofs were given by Atle Selberg and Paul Erd\"os in the 1930's.

On the other hand, there are "lots" of composite numbers around. For example, here is a run of 1000 consecutive composite numbers:

You can use the same method to generate runs of composite numbers of any length.

Example. Use the Prime Number Theorem to estimate the number of primes less than .

By the Prime Number Theorem,

The actual number of primes less than is .

On the other hand, many problems concerning the distribution of primes are unsolved. For example, there are primes that come in pairs (two units apart), such as 11 and 13, or 71 and 73. These are called twin primes.

Question: ( Twin Prime Conjecture) Are there infinitely many twin primes?

There are enormously large twin primes known. The largest pair currently known were discovered in 2011, and are

The Twin Prime Conjecture is still unresolved: A proof is announced every now and then, but no proof has passed the scrutiny of the mathematics community yet.

Example. Find all prime numbers p such that is a perfect square.

Write

Note that if , then , which has no solutions since the left side must be positive.

Further, I may assume . For if , then , and also satisfies the equation:

In other words, if there are x's that work, there must be positive x's that work.

Now rewrite the equation:

Since , I have . Now and are positive, so must be positive as well.

Thus, the equation expresses as a product of two positive numbers. Since 11 and p are prime, there are 4 ways to do this. I consider each of the cases.

Case 1: and .

The first equation gives , so the second equation says , which is prime. This is a solution.

Case 2: and .

The second equation gives , so the first equation says , which is prime. This is a solution.

Case 3: and .

The second equation gives , so the first equation says . This is a contradiction, because .

Case 4: and .

The first equation gives , but this is ruled out by the assumption that .

All together, the primes p for which is a perfect square are and .

A great resource for prime numbers is the Prime Pages at http://primes.utm.edu.

Contact information