



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Discrete maths proofs on prime numbers
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!
Before starting our study of primes, we record the following important lemma. Recall that integers a, b are said to be relatively prime if gcd(a, b) =
Lemma (Euclid’s Lemma). If gcd(a, b) = 1 and a | bc then a | c.
Proof. This is an application of Bezout’s Theorem, which tells us that there are integers x, y such that 1 = ax + by. Multiply this equation on both sides by c and you get c = acx + bcy.
Since a divides acx (obviously) and a divides bcx (by hypothesis) it follows that a divides their sum, so a divides c.
Definition. A prime number is a positive integer with exactly two positive divisors.
If p is a prime then its only two divisors are necessarily 1 and p itself, since every number is divisible by 1 and itself.
The first ten primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29.
It should be noted that 1 is NOT PRIME.
Lemma. If p is prime then gcd(a, p) = 1 if and only if p does not divide a.
The proof is an easy exercise with the definitions. This result says in par- ticular that if p is prime then p is relatively prime to all numbers except the multiples of p.
Combining this with Euclid’s Lemma we get the following.
Corollary. If p is prime and p | ab then either p | a or p | b.
Proof. Suppose p is prime and p | ab. If p | a we are done. If not, then gcd(p, a) = 1 and by Euclid’s Lemma we conclude that p | b.
Definition. Any integer greater than 1 which is not prime is called com- posite.
The first few composite numbers are 4, 6, 8, 9, 10, 12, 14, 15.
You may already know the result that every composite integer can be fac- tored into a product of primes. That fact, and the fact that the factorization is unique except for the ordering of the prime factors, is called the Funda- mental Theorem of Arithmetic.
The main goal of this lecture is to prove the fundamental theorem of arith- metic. Before we do that, we prove a few other results.
Lemma. Every integer greater than 1 has at least one prime divisor.
Proof. (By contradiction) Assume there is some integer greater than 1 with no prime divisors. Then the set of all such integers is non-empty, and thus (by the well-ordering principle) has a least element; call it n.
By construction, n has no prime divisors, and n is a divisor of n, so n is not prime. In other words, n is composite. This means that n has at least three positive divisors, and so has at least one positive divisor, a, other than 1 and n. Thus n = ab for integers a, b such that 1 < a < n, 1 < b < n.
Since 1 < a < n we know that a has a prime divisor (since n was the smallest integer greater than 1 with no prime divisors). But this is a contradiction, since that prime divisor of a is also a prime divisor of n. This contradiction proves the lemma.
Theorem. There are an infinite number of primes.
Proof. (By contradiction) Assume there are only finitely many primes, say they are p 1 , p 2 ,... , pk. Set P = p 1 p 2 · · · pk and put M = P +1. Since M > 1 the lemma says that M has a prime divisor; call it q. Since p 1 , p 2 ,... , pk is a complete list of all the primes, by our assumption, we must have q = pj for some j. But then q divides the product P = p 1 p 2 · · · pk, so q divides M − P = 1. Since q > 1 this is a contradiction: no integer greater than 1 can divide 1.
This contradiction shows our assumption at the beginning is impossible, which proves the result.
Note: The preceding proof is due to Euclid.
$ python
from isprime import * isprime(37) True isprime(8901) False
Once the interpreter is running, you can test numbers to your heart’s con- tent. Type quit() or CTRL-D to quit the Python session.
Be advised that if you type in a number that is “too large” then you may have to wait a long time for an answer!
The previous theorem is also used in the Sieve of Eratosthenes, which is a simple algorithm to compute all the primes up to a given bound. We illustrate by computing all the primes up to 100. Start by listing all the numbers starting with 2:
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
and then cross out the proper multiples of 2 through 10. The remaining numbers are the primes up to 100.
There are many easy to state conjectures about primes that remain unsolved to this day. Here are two famous examples.
Conjecture (Twin prime conjecture). There are infinitely many pairs of primes of the form p, p + 2.
Conjecture (Goldbach’s conjecture). Every even integer greater than 2 can be written as a sum of two primes.
These problems are considered to be very hard, mainly because little progress has been made on them and they have been around for a long time. Gold- bach’s conjecture, for example, dates back to the year 1742!
Theorem (Fundamental Theorem of Arithmetic). Every positive integer greater than 1 can be written as a product of primes. If we arrange the factors in order then the factorization is unique.
There are two parts to the proof: existence and uniqueness. The existence part is an easy induction, and we do it now.
If n is prime, then n = n is expressing n as a product of primes (trivially).
If n is a composite integer greater than 1, we already showed that n must have a prime divisor, say q. Then n/q, which is smaller than n, can be written as a product of primes by the inductive hypothesis. So n/q = p 1 p 2 · · · pk, and thus n = qp 1 p 2 · · · pk is expressible as a product of primes. This proves the existence statement.
It remains to prove the uniqueness part of the theorem. This requires a lemma.
Lemma. If p is a prime and p divides a product a 1 a 2 · · · ak of integers, then p must divide at least one of the factors of the product.
Proof. This is a consequence of Euclid’s Lemma. We prove the result by induction on the number k of factors. If k = 1 the result is trivial.
Assume the result holds for all products with k factors, and consider a prod- uct a 1 a 2 · · · akak+1 = a 1 (a 2 · · · akak+1) of integers with k + 1 factors which is divisible by p. If p divides a 1 then we are done. Otherwise, gcd(p, a 1 ) = 1 and thus by Euclid’s Lemma p must divide the product p 2 · · · pk+1. Since this is a product with k factors the induction hypothesis applies to show there must be a factor divisible by p.
Now we use the lemma to prove uniqueness of prime factorization. The proof is by contradiction. Let n be an integer greater than 1. Assume that n can be expressed in two different ways as a product of primes:
n = p 1 p 2 · · · pr = q 1 q 2 · · · qs.
There may be some factors in common, so cancel them from both sides. After canceling all common factors, we are left with an equation
pi 1 pi 2 · · · piu = qj 1 qj 2 · · · qjv
with no common factors, and at least one prime appearing somewhere. This is a contradiction, since by the lemma that prime must be a factor of the other side in which it appears, and thus we would still have a common factor.
This contradiction shows that prime factorization is unique, and completes the proof of the fundamental theorem of arithmetic.