Lec04 PrimeNumbers
Lec04 PrimeNumbers
1 Introduction
An integer n is called prime if n > 1 and if the only positive divisors of n are 1 and n.
If n > 1 and if n is not prime, then n is called composite.
Examples: some primes are 2,3,5,7,11,. . . ,89,97,101,103,. . . ,127,157,257,3583,3659.
Thus a number n is composite iff ∃ integers a, b with 1 < a < n and 1 < b < n such
that n = a · b.
Some composite numbers are 4,6,8,9,10,12,14,. . . , 91,92,93,94,95,96,98,99,100,102,111
with
4 = 2 · 2, 30 = 2 · 3 · 5, 111 = 3 · 37, . . . . . . . . ..
Note that 1 is neither prime nor composite.
Prime numbers are the multiplicative building blocks of the integers.
Theorem 1.1. Every integer n > 1 is either a prime number or a product of prime
numbers.
Proof. We apply strong induction on n. The theorem is clearly true for n = 2. Assume it
is true for every integer < n. Then if n is not prime it has a positive divisor d 6= 1, d 6= n.
Hence n = cd, where c 6= n. But both c and d are < n and > 1 so each of c, d is a
product of prime numbers, hence so is n.
Qn = p1 p2 · · · pn + 1.
1
Prof A. Munagi Prime Numbers MATH4024-Number Theory
Now Q > 1, so Q has a prime divisor, say q. Then notice that q 6= pj for j = 1, 2, . . . , n.
If q = pj , then q|(Qn − p1 p2 · · · pn ) or q|1 which s impossible. Thus q must be a new
prime not in the original list. Hence there are infinitely many primes.
Q2 = 2 · 3 + 1 = 7 (prime)
Q3 = 2 · 3 · 5 + 1 = 31 (prime)
Q4 = 2 · 3 · 5 · 7 + 1 = 211 (prime)
Q5 = 2 · 3 · 5 · 7 · 11 + 1 = 2311 (prime)
Q6 = 2 · 3 · 5 · 7 · 11 · 13 + 1 = 30031 = 59 · 509 (bigger primes)
.. .. .. .. ..
. . . . .
Remark 1.4. Euclid proved a more general statement than Theorem 1.2, namely, he
showed that the same proof works for any finite set of primes (not just the initial ones).
Exercise 1. Let R = {pj1 , pj2 , . . . , pjk } be a set of k distinct primes. Prove that there
is at least one prime number q ∈ / R.
Given a real number x, the prime counting function π(x), is defined as the number
of primes not exceeding x.
We can find all primes counted by π(n) using the Sieve of Eratosthenes. It is a
very efficient algorithm based on Exercise 2. √
For example, to find primes ≤ 40, we first note that the primes p satisfying p ≤ 40
are p = 2, 3, 5.
Then according to this sieve, we start by writing out the consecutive integers from
1 to 40:
2
Prof A. Munagi Prime Numbers MATH4024-Number Theory
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
Next, successively cross out all multiples of p, except p, for each p = 2, 3, 5. Thus when
this step is executed for p = 2 (using a slash /) and for p = 3 (using a backlash \), we
get
1 2 3 4 5 6A 7 8 9A 10
11 12
Z
Z
13 14
Z
15
Z 16
17 18
Z
Z
19 20
21
Z
Z 22
23 24
Z 25
Z
26
27
Z
Z 28
29 30
Z
Z
31 32
33
Z
Z 34
35
36
Z
Z 37 38
39
Z
Z 40
When this step is also executed for p = 5 (this would cross out 25 and 35), we find
that the remaining numbers, not marked in the list (except 1), are all the primes less
than or equal to 40, namely,
Exercise 4. Use the sieve of Eratosthenes to find all primes less than 200.
3
Prof A. Munagi Prime Numbers MATH4024-Number Theory
Theorem 2.1 (Dirichlet). Suppose a and b are positive integers not both divisible by
some prime. Then the arithmetic progression
an + b, n = 1, 2, 3, . . . ,
Theorem 2.2. There are infinitely many primes of the form 4n + 3, where n ∈ Z.
Proof. Assume that there is only a finite number of primes of the form 4n + 3, say
p0 = 3, p1 , p2 , . . . , pr , and let
Q = 4p1 p2 · · · pr + 3.
Then there is at least one prime in the factorization of Q of the form 4n + 3. Otherwise
all the prime factors would be of the form 4n + 1, and by Exercise 6, this would imply
that Q is of this form, a contradiction.
But none of the primes p0 , p1 , . . . , pr divides Q. Note that 3 - Q, for if 3|Q,
then 3|(Q − 3) =⇒ 3|4p1 p2 · · · pr , a contradiction. Similarly, if pj |Q, then pj |(Q −
4p1 p2 · · · pr ) =⇒ pj |3, which is absurd.
Hence there are infinitely many primes of the form 4n + 3.