Prime Numbers
Prime Numbers
Prime Numbers
Definition. An integer n greater than 1 is prime if the only positive divisors of n are 1 and n.
A positive integer n which has a positive divisor other than 1 or n is composite.
People are often puzzled by the fact that 1 is not considered to be prime. Excluding 1 is a convention
which makes other things more convenient (such as the statement of the Fundamental Theorem of
Arithmetic).
Example. (Small prime numbers and composite numbers) List the prime and composite numbers
in the set {1, 2, . . . 10}.
Primes:
2, 3, 5, 7, ....
Composite numbers:
4, , 6, , 8, 9.
You’ve probably seen the classical proof of the next result, which goes back to Euclid. Well, in case you
haven’t (or you’ve forgotten), here it is.
Proof. Suppose on the contrary that there were only finitely many primes p1 , p2 , . . . pn . Every integer
greater than 1 is either prime — so it’s one of the p’s — or it’s composite, and by the preceding lemma,
divisible by one of the p’s.
Consider the number m = p1 p2 · · · pn + 1. m leaves a remainder of 1 when it’s divided by p1 , p2 , . . . pn .
Therefore, it’s not composite. But it can’t be one of the primes, since it’s larger than all of the p’s. This is
a contradiction, so there must be infinitely many primes.
Prime numbers used to be a mathematical curiosity. In the last few decades, they’ve found important
applications — for example, to the field of cryptography. But there’s still a lot to be curious about.
Question. (Goldbach’s conjecture) Can every even integer greater than 4 be expressed as the sum
of two primes?
Goldbach’s conjecture has been verified for even numbers up to around 1014 .
Question. (Twin Prime conjecture) Twin primes are prime number which are 2 units apart (such
as 5 and 7). Are there infinitely many twin primes?
1
The largest known twin primes as of this writing are 2996863034895 · 21290000 ± 1. They have 388 342
digits.
Question. A Mersenne prime is a prime number of the form 2n − 1, where n is a positive integer
(such as 31 = 25 − 1). Are there infinitely many Mersenne primes?
The Mersenne prime 277 232 917 − 1 is the largest known prime number as of January, 2018. It was
discovered on December 26, 2017 by Jonathan Pace as a part of GIMPS (the Great Internet Mersenne Prime
Search: www.mersenne.org). It has 23 249 425 decimal digits.
Proof. Suppose that (p, a) = 1. I want to show that p 6 | a. Suppose on the contrary that p | a. Since p | p,
p is a common divisor of p and a. Therefore, p | (p, a) = 1. This is a contradiction, since p is prime.
Conversely, suppose p 6 | a. I want to show that (p, a) = 1.
Now (p, a) | p, and the only positive numbers that divide p and 1 and p. Therefore, (p, a) = 1 or
(p, a) = p.
Suppose (p, a) = p. Then p = (p, a) | a, which contradicts my assumption that p 6 | a.
Therefore, (p, a) 6= p, so (p, a) = 1.
Proof. Let p be prime, and suppose p | ab. To show that p | a or p | b, I’ll assume that p 6 | a and prove that
p | b.
Since p 6 | a, the preceding result says that (p, a) = 1. Therefore, I can find integers m and n such that
mp + na = 1.
Multiply by b:
mpb + nab = b.
p | mpb, and by assumption p | ab, so p | nab. Therefore, p | mpb + nab = b, which is what I wanted to
prove.
Remarks. 1. There is a general version of Euclid’s lemma: If p is prime and p | a1 a2 · · · an , then p divides
at least one of the a’s.
2. If p and q are primes and p | q, then p = q. (Only 1 and q divide q, and p isn’t 1, so it must be q.) Using
this fact and the general version of Euclid’s lemma, you can show that if p and q are primes, n ≥ 1, and
p | q n , then p = q.
Example. (Using Euclid’s lemma to prove a divisibility statement) Prove that if p is prime and
p | a2 , then p | a.
Try writing out the induction proof that shows that if p is prime, n > 2, and p | an , then p | a.
Example. (A problem on primes and squares) For what prime numbers p is 13p + 1 a perfect square?
Suppose 13p + 1 = x2 , where x ∈ Z. First, if x = 0, then 13p + 1 = 0, so 13p = −1. Since p is prime, it
is positive, and this is a contradiction.
2
Therefore, x 6= 0, and I may assume without loss of generality that x is positive: If x is negative, then
−x is positive, and 13p + 1 = (−x)2 holds.
Thus, I’m now assuming that x > 0.
I’ll rule out another special case: If x = 1, I have 13p + 1 = 1, or 13p = 0. Since p is prime, p > 1, so
this is impossible.
Now I can assume that x > 1. This means that x − 1 > 0. Moreover, x + 1 > x − 1, so x + 1 > 0. In
other words, x − 1 and x + 1 are positive numbers.
Now I’ll proceed with the main part of the proof. I have
This says that x − 1 and x + 1 are positive factors of 13p. Since 13 and p are prime, the only positive
factors of 13p are 1, p, 13, and 13p. There are four cases.
Suppose that 13 = x − 1 and p = x + 1. The first equation gives x = 14, so p = 15. This contradicts
the fact that p is prime.
Suppose that 13 = x + 1 and p = x − 1. The first equation gives x = 12, so p = 11. 11 is prime, and
13 · 11 + 1 = 144 = 122 .
Suppose that 13p = x − 1 and 1 = x + 1. The second equation gives x = 0, but I’m assuming x > 0.
This contradiction rules out this case.
Finally, suppose that 1 = x − 1 and 13p = x + 1. The first equation gives x = 2, which yields 13p = 3 in
the second equation. But p is prime, so p > 1, and 13p > 13. Thus, 13p can’t equal 3, and this contradiction
rules out this case.
Thus, the only prime p for which 13p + 1 is a perfect square is p = 11.
Theorem. (The Fundamental Theorem of Arithmetic) Let n be an integer, n > 1. Then n can be
written as a product of prime numbers, and this product is unique up to the order of the factors.
“Up to the order of the factors” means that 2 · 3 and 3 · 2 are considered to be “the same” factorization
of 6.
Proof. First, I’ll show that every integer greater than 1 can be factored into a product of primes.
I’ll use induction. Start with n = 2; this is prime, so the result holds for n = 2.
Next, let n > 2, and suppose every integer greater than 1 and less than n can be factored into a product
of primes. If n is prime, then n is a product of primes (namely, itself), and I’m done.
Otherwise, n is composite. This implies that there are integers a and b with 1 < a, b < n such that
n = ab. Since a and b are between 1 and n, each of them can be factored into a product of primes, by the
induction hypothesis. Then n = ab shows that the same is true of n.
By induction, every integer greater than 1 can be factored into a product of primes.
Next, I want to show that the prime factorization of a positive integer is unique, up to the order of the
factors.
Suppose I have two prime factorizations of the same number:
Thus, the p’s and q’s are primes, all the p’s are distinct and all the q’s are distinct (but some p’s may
be q’s, and vice versa), and all the exponents are positive.
Start with p1 . It’s prime, and it divides the left side, so it divides the right side:
3
Now the equation looks like this:
I cancel as many p1 ’s off both sides as I can. Suppose I wind up with some left-over p1 ’s on the right:
Now I repeat the divisibility argument. p1 divides the right side, so it divides the left side pr22 · · · prmm .
As before, this means that p1 is one of p2 , . . . , pm . This is a contradiction, because I assumed at the start
that the p’s were distinct.
This means that there can’t be any left-over p1 ’s on the right, and a similar argument shows that there
can’t be any left-over p1 ’s on the left. Hence, all the p1 ’s must have cancelled, and I have
I continue in this way, matching up prime powers on the two sides. Eventually, everything must match
up (just as pr11 and q1s1 did), which shows that the two original factorizations were identical.
This proves that the prime factorization of an integer is unique, up to order.
Example. (Factoring a number into primes) Apply the Fundamental Theorem of Arithmetic to 3768.
Trial division is not a useful way of factoring numbers once they get too large. In general factoring big
integers is a hard problem involving many sophisticated methods.
Definition. If m and n are positive integers, the least common multiple of m and n is the smallest
positive integer which is divisible by both m and n. The least common multiple of m and n is denoted
[m, n].
(a) [24, 16] = 48, since 24 | 48 and 16 | 48, and no smaller positive integer is divisible by both 24 and 16.
(b) The least common multiple of p2 and p4 is p4 , since it’s clearly the smallest power of p divisible by both
p2 and p4 . You can see that for two positive powers of a prime, their least common multiple is the largest
of the two powers. So for q 5 and q 3 , the least common multiple is q 5 . Hence, [p2 q 5 , p4 , q 3 ] = p4 q 5 .
The prime factorization of a number provides a way of visualizing greatest common divisors and least
common multiples.
Example. (Finding greatest common divisors and least common multiples using prime factor-
izations) Represent the greatest common divisor and least common multiple of 120 and 280 by drawing a
Venn diagram involving their prime factorizations.
Note that
120 = 2 · 2 · 2 · 3 · 5 and 280 = 2 · 2 · 2 · 5 · 7.
4
Arrange the prime factors of the two numbers in a Venn diagram:
120
280
3 2 2
5 2
7
The factors 2, 2, 2, and 5 are common to the two numbers. They go in the intersection (shaded), and
their product 2 · 2 · 2 · 5 = 40 is equal to the greatest common divisor (120, 280).
The least common multiple [120, 280] is the product of all the numbers in the diagram (counted once
each):
[120, 280] = 3 · (2 · 2 · 2 · 5) · 7 = 1680.
Note that if you multiply 120 and 280, this counts the primes in the intersection — whose product is
(120, 280) — twice, whereas [120, 280] counts the primes in the intersection once. It follows that
This is true in general: If m and n are positive integers, then mn = [m, n] · (m, n). The argument above
isn’t a proof, but it makes the result plausible.