Prime Numbers
Total Page:16
File Type:pdf, Size:1020Kb
Prime Numbers Definition. An integer n is said to be a prime if and only if n > 1 and the only positive divisors of n are 1 and n: A positive integer n is said to be composite if and only if n > 1 and n is not a prime. Thus, n > 1 is composite if and only if there exist integers a and b with 1 < a; b < n such that n = a b: · As an exercise using the division algorithm, we prove the following: Theorem. If p and p2 + 2 are both primes, then p2 2 is also a prime. − Proof. Suppose that p is a prime, when the division algorithm is used to divide p by 3; p = 3q + r where 0 r 2; so the only possible remainders are r = 0; r = 1; and r = 2: ≤ ≤ case 1 : If r = 0; then p = 3q for some positive integer q; and since p is prime, we must have q = 1; so that p = 3: In this case, p2 + 2 = 32 + 2 = 9 + 2 = 11 is a prime, and p2 2 = 9 2 = 7 is also a prime. Thus, the − − implication is true for p = 3: The implication is also true if p = 3 and 3 p; since in this case the hypothesis is false. 6 case 2 : If r = 1; then p = 3q + 1 for some positive integer q; and p2 + 2 = (3q + 1)2 + 2 = 9q2 + 6q + 3 = 3(3q2 + 2q + 1) 2 2 and 3 p + 2: Since the second factor is clearly greater than 1; then p + 2 is composite in this case, and again the implication is true since the hypothesis is false. case 3 : If r = 2; then p = 3q + 2 for some positive integer q; and p2 + 2 = (3q + 2)2 + 2 = 9q2 + 12q + 6 = 3(3q2 + 4q + 2) 2 2 and again 3 p + 2: Since the second factor is clearly greater than 1; then p + 2 is also composite in this case, and again the implication is true since the hypothesis is false. Therefore, if p and p2 + 2 are both prime, then p2 2 is also prime. − We will show that there are infinitely many primes, in fact, the proof we give is Euclid's original proof. Lemma. Every positive integer n > 1 has a prime divisor. Proof. Let S = n Z n > 1 and n has no prime divisors : If S = ; since S is bounded below, by the f 2 j g 6 ; well ordering property S has a smallest element, say n0 S: 2 Since n0 > 1 and n0 has no prime divisors, then n0 is composite, and there exist integers a0; b0 Z such that 2 n0 = a0 b0 · where 1 < a0 < n0 and 1 < b0 < n0: However, since 1 < a0 < n0 and n0 is the smallest element in S; then a0 S; which implies that a0 has a 62 prime divisor, say p a0; but then p n0 also, which is a contradiction. Therefore, the assumption that S = leads to a contradiction, and we must have S = ; so that every positive integer n > 1 has a prime divisor.6 ; ; Theorem. There are infinitely many primes. Proof. Suppose not, suppose that p1; p2; : : : ; pN are the only primes. Now consider the integer M = p1 p2 pN + 1; · · · · from the previous lemma, M has a prime divisor, and it must therefore be one of the primes p1; p2; : : : ; pN : This is a contradiction, since none of these primes divides M: The Fundamental Theorem of Arithmetic The Fundamental Theorem of Arithmetic states that if n > 1 is a positive integer, then n can be written as a product of primes in only one way, apart from the order of the factors. Recall that an integer n is said to be a prime if and only if n > 1 and the only positive divisors of n are 1 and n: In order to prove the fundamental theorem of arithmetic, we need the following lemmas. Lemma 1. Every integer n > 1 is either a prime number or a product of prime numbers. proof. We will prove this by induction on n: The lemma is clearly true for n = 2: Assume now that it is true for every positive integer k with 2 k < n: If n is not a prime, then it has a positive divisor d with d = 1 and d = n: Therefore, n = m d; ≤where m = n: However, both m and d are less than n and greater than6 1; so by6 the induction hypothesis· each of m and6 d is a product of primes, therefore n is also a product of primes. This completes the induction. Lemma 2. If a prime p does not divide a; then gcd(p; a) = 1: proof. Let d = gcd(p; a); then d p and p is prime, so that d = 1 or d = p: However, d a; so we must have d = p; since p a: Therefore, d = 1: 6 6 Lemma 3. If a prime p divides ab; then p a or p b: More generally, if a prime p divides a product a1a2 an; · · · the p divides at least one of the integers a i; for 1 i n: ≤ ≤ proof. Suppose that p ab and that p a: We will prove that p b: From Lemma 2 we have gcd(p; a) = 1; and by the Euclidean algorithm there exist6 integers x and y such that 1 = xa + yp; and therefore, b = x ab + yb p; · · so that p b: For the more general statement, use induction on n: Theorem (Fundamental Theorem of Arithmetic). Every integer n > 1 can be represented as a product of prime factors in only one way, apart from the order of the factors. proof. The proof is by induction on n: The theorem is true for n = 2: Assume, then, that the theorem is true for all integers k with 1 < k < n: We will show that this implies that it is also true for n: If n is prime, then there is nothing more to prove. Assume, then, that n is composite and that n has two factorizations, say n = p1p2 ps = q1q2 qt: ( ) · · · · · · ∗ We want to show that s = t and that each pi equals some qj : Since p1 q1q2 qt and p1 is prime, then by Lemma 3, p1 must divide some qj : We may assume then (relabel) · · · that p1 q1; and therefore p1 = q1 since they are both primes. In ( ) we can cancel p1 on both sides to get ∗ n = p2 ps = q2 : : : qt: p1 · · · n n If s > 1 or t > 1; then 1 < < n; and by the induction hypothesis the two factorizations of must be p1 p1 identical, apart from the order of the factors. Therefore s = t and the factorizations in ( ) are also identical, apart from the order of the factors. The induction is complete. ∗ Note: In the factorization of an integer n; a particular prime p may occur more than once. If the distinct prime factors of n are p1; p2; : : : ; pk; and if pi occurs as a prime factor αi times, for 1 i k then we can write ≤ ≤ α1 α2 αk n = p1 p2 p ; · · · k that is, k αi n = Y pi ; i=1 and this is called the factorization of n into prime powers. We can also express 1 in this form by taking each exponent αi = 0: Corollary. If k αi n = Y pi ; i=1 then the set of positive divisors of n is the set of all numbers d of the form k βi d = Y pi ; i=1 where 0 βi αi for i = 1; 2; : : : ; k; and the number of positive divisors of n; denoted by τ(n); is given by ≤ ≤ τ(n) = (1 + α1)(1 + α2) (1 + αk): · · · As an example of the use of the prime factorization of an integer, we have the following result. Theorem. If n > 1 is a positive integer, then n is a perfect square if and only if n has an odd number of divisiors. Proof. Let the prime factorization of n be given by α1 α2 αk n = p1 p2 p · · · k where p1 < p2 < < pk are distinct primes and for 1 i k; each of the integers αi 1: · · · ≤ ≤ ≥ Now note that n is a perfect square if and only if each αi is an even integer, that is, if and only if there exist positive integers βi such that αi = 2βi for 1 i k: ≤ ≤ From the previous corollary, n is a perfect square if and only if the number of divisors of n is τ(n) = (2β1 + 1)(2β2 + 1) (2βk + 1); · · · that is, if and only if τ(n) is an odd integer. Example. The Locker Problem A certain locker room contains n lockers numbered 1; 2; : : : ; n and they are all originally locked. An attendant performs a sequence of operations T1; T2; : : : ; Tn whereby with the operation Tk; 1 k n; the condition of being locked or unlocked is changed for all those lockers and only those lockers whose≤ n≤umbers are multiples of k: Show that after all the n operations have been performed, all those lockers whose numbers are perfect squares (and only those lockers) are now open or unlocked. proof. Locker number m; for 1 m n; will be unlocked after the n operations have been performed if and only if it has changed state ≤an odd≤ number of times, that is, if and only if the integer m has an odd number of positive divisors. Therefore, locker number m is unlocked after all n operations are performed if and only if m is a perfect square.