CHAPTER 6. Prime Numbers. Definition and Fundamental Results

Similar documents
An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p.

Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively

7. Prime Numbers Part VI of PJE

7.2 Applications of Euler s and Fermat s Theorem.

CHAPTER 3. Congruences. Congruence: definitions and properties

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald)

Lecture 4: Number theory

A SURVEY OF PRIMALITY TESTS

The Chinese Remainder Theorem

1 Overview and revision

LECTURE 4: CHINESE REMAINDER THEOREM AND MULTIPLICATIVE FUNCTIONS

Math 324, Fall 2011 Assignment 7 Solutions. 1 (ab) γ = a γ b γ mod n.

All variables a, b, n, etc are integers unless otherwise stated. Each part of a problem is worth 5 points.

MATH 2200 Final Review

2.3 In modular arithmetic, all arithmetic operations are performed modulo some integer.

A Guide to Arithmetic

Chapter 5. Modular arithmetic. 5.1 The modular ring

a = mq + r where 0 r m 1.

SOLUTIONS Math 345 Homework 6 10/11/2017. Exercise 23. (a) Solve the following congruences: (i) x (mod 12) Answer. We have

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

Number Theory Proof Portfolio

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element.

NUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z:

1. multiplication is commutative and associative;

M381 Number Theory 2004 Page 1

CS 5319 Advanced Discrete Structure. Lecture 9: Introduction to Number Theory II

Basic elements of number theory

Basic elements of number theory

PRIME NUMBERS YANKI LEKILI

MATH 361: NUMBER THEORY FOURTH LECTURE

MATH 310: Homework 7

Euler s, Fermat s and Wilson s Theorems

Part IA Numbers and Sets

Homework 3, solutions

4 PRIMITIVE ROOTS Order and Primitive Roots The Index Existence of primitive roots for prime modulus...

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations

CPSC 467b: Cryptography and Computer Security

10 Problem 1. The following assertions may be true or false, depending on the choice of the integers a, b 0. a "

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers

Fermat s Little Theorem. Fermat s little theorem is a statement about primes that nearly characterizes them.

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya

A Few Primality Testing Algorithms

Part II. Number Theory. Year

MATH FINAL EXAM REVIEW HINTS

SOLUTIONS TO PROBLEM SET 1. Section = 2 3, 1. n n + 1. k(k + 1) k=1 k(k + 1) + 1 (n + 1)(n + 2) n + 2,

CPSC 467: Cryptography and Computer Security

5: The Integers (An introduction to Number Theory)

Part IA Numbers and Sets

EULER S THEOREM KEITH CONRAD

PREPARATION NOTES FOR NUMBER THEORY PRACTICE WED. OCT. 3,2012

Beautiful Mathematics

Corollary 4.2 (Pepin s Test, 1877). Let F k = 2 2k + 1, the kth Fermat number, where k 1. Then F k is prime iff 3 F k 1

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

Q 2.0.2: If it s 5:30pm now, what time will it be in 4753 hours? Q 2.0.3: Today is Wednesday. What day of the week will it be in one year from today?

8 Primes and Modular Arithmetic

Number Theory Homework.

Introduction to Number Theory

Lecture Notes. Advanced Discrete Structures COT S

Instructor: Bobby Kleinberg Lecture Notes, 25 April The Miller-Rabin Randomized Primality Test

Summary Slides for MATH 342 June 25, 2018

Introduction to Public-Key Cryptosystems:

Discrete Mathematics with Applications MATH236

p = This is small enough that its primality is easily verified by trial division. A candidate prime above 1000 p of the form p U + 1 is

* 8 Groups, with Appendix containing Rings and Fields.

MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences.

2 More on Congruences

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5

Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6

Chapter 5. Number Theory. 5.1 Base b representations

The Chinese Remainder Theorem

Exercises Exercises. 2. Determine whether each of these integers is prime. a) 21. b) 29. c) 71. d) 97. e) 111. f) 143. a) 19. b) 27. c) 93.

Elementary Number Theory Review. Franz Luef

Math 109 HW 9 Solutions

Chapter 1 : The language of mathematics.

Ma/CS 6a Class 2: Congruences

Number Theory and Algebra: A Brief Introduction

Winter Camp 2009 Number Theory Tips and Tricks

NOTES ON SIMPLE NUMBER THEORY

MATH 4400 SOLUTIONS TO SOME EXERCISES. 1. Chapter 1

Chapter 5: The Integers

Algorithmic number theory. Questions/Complaints About Homework? The division algorithm. Division

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers Solutions

LARGE PRIME NUMBERS (32, 42; 4) (32, 24; 2) (32, 20; 1) ( 105, 20; 0).

Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography

MATH 2112/CSCI 2112, Discrete Structures I Winter 2007 Toby Kenney Homework Sheet 5 Hints & Model Solutions

Number Theory Alex X. Liu & Haipeng Dai

COMP239: Mathematics for Computer Science II. Prof. Chadi Assi EV7.635

NONABELIAN GROUPS WITH PERFECT ORDER SUBSETS

I Foundations Of Divisibility And Congruence 1

0 Sets and Induction. Sets

Theory of Numbers Problems

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

2301 Assignment 1 Due Friday 19th March, 2 pm

The group (Z/nZ) February 17, In these notes we figure out the structure of the unit group (Z/nZ) where n > 1 is an integer.

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time.

4 Number Theory and Cryptography

ECE596C: Handout #11

Elementary Algebra Chinese Remainder Theorem Euclidean Algorithm

Solutions to Practice Final

Definitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations

Transcription:

CHAPTER 6 Prime Numbers Part VI of PJE. Definition and Fundamental Results 6.1. Definition. (PJE definition 23.1.1) An integer p is prime if p > 1 and the only positive divisors of p are 1 and p. If n > 1 and n is not prime, n is said to be composite. The integer 1 is neither prime nor composite. 6.2. Remark. The definition implies that n is composite if, and only if, n = ab for some integers a, b with 1 < a, b < n. (Proof If n = ab where a, b > 1, then n > 1 and n is not prime since a n, a 1, a n; thus, n is composite. Vice versa, if n is composite, then n > 1 and n has a positive divisor a other than 1 and n; this means that 1 < a < n and that n = ab with 1 < b = n/a < n.) Example. The first few prime numbers are 2, 3, 5, 7, 11, 13, 17, 19,... Aside It is a hard problem to prove that a given large integer (say with 150 digits) is prime. But some very large primes are known, such as 2 74,207,281 1 with more than 22 million decimal digits, found on 7 January 2016 by the Great Internet Mersenne Prime Search. At the time of its discovery, this was the largest known prime number. End of aside Question. What is the connection with the earlier definition of coprime? 6.3. Lemma. If p is prime and p a then p and a are coprime. Proof. PJE p.279 The only positive divisors of p are 1 and p. Out of these, p is not a divisor of a by assumption, so the only common positive divisor of p and a is 1. Hence gcd(p, a) = 1. 51

Prime Numbers 52 6.4. Proposition. (PJE proposition 23.1.2) Every integer n > 1 is a product of primes. (With the convention that a product can be of just one prime!) Proof PJE p.278. We prove this by strong induction. Base case: n = 2 which is a product of one prime. Indictive step: Assume that for all n such that 2 n k, n is a product of primes. Our goal is to prove that k + 1 is a product of primes. Indeed, if k + 1 is a prime, it is a product of one prime. Otherwise, k + 1 is not a prime, hence k + 1 is composite and k + 1 = ab with 1 < a, b < k + 1. But then 2 a, b k so by Inductive Hypothesis, a, b are products of primes. But then k + 1 = ab is also a product of primes. Conclusion: by strong induction, every integer n 2 is a product of primes. 6.5. Theorem. Euclid s property of a prime If p is a prime, then for all integers a, b, if p divides ab then p a or p b. Proof (PJE theorem 23.1.3 but we do not assume a, b to be positive) Let a, b Z. It is enough to assume that p a and then to show that that p b. By Lemma 6.3, p is coprime to a; but p ab, so by Corollary 2.22 p b, as required. Aside This result motivates the definition of a prime in more advanced work. End of aside Example. The number 6 is not prime, because 6 has positive divisors 2, 3 which are neither 1 nor 6. Another way to prove that 6 is not prime would be to show that 6 does not possess Euclid s property of a prime. For example, 6 24, yet 24 = 3 8 and 6 3 and 6 8; hence by Theorem 6.5, 6 is not prime. 6.6. Corollary. If a prime p divides the product a 1 a 2... a n of integers a 1,..., a n, then p a i for some 1 i n. Proof Induction in n, see PJE proposition 23.3.2 (proof not given in class). Now we can prove that the product of primes guaranteed by Theorem 6.4 is unique (up to ordering).

Prime Numbers 53 6.7. Theorem. Fundamental Theorem of Arithmetic (PJE theorem 23.3.1) Every integer greater than 1 can be written as a product of primes unique up to ordering, i.e. for all n 2 there exist unique r and unique primes p 1 p 2 p r such that n = p 1 p 2... p r. Proof PJE p.283 Existence of prime factorisation is by Proposition 6.4. To prove uniqueness, assume for contradiction that two different products of primes give the same result. Cancel all primes which appear in both products, obtaining (*) p 1 p 2... p r = q 1 q 2... q s where p i q j for all i, j. Then p 1 q 1 q 2... q s so by Corollary 6.6 p 1 q j for some j. But since q j is prime, the only divisor of q j greater than one is q j. So p 1 = q j, contradicting (*). Primality testing: how to check if n is a prime number? From the definition of a prime number, it appears that we have to check each number from 2 to n 1 to see if it is a divisor of n. The process is made more efficient by the following result. 6.8. Proposition. (PJE proposition 23.2.1) If m is composite then m has a prime divisor not exceeding m. That is, composite m, prime p: p m and p m. Proof PJE p.280 but I give an alternative proof here. Let m = p 1 p 2... p r be the prime factorisation of m with p 1 p 2 p r. Note that r 2 since m is not a prime. Then m p 1 p 1... p 1 = p r 1 p2 1. Hence m p 1. 6.9. Application: Sieve of Eratosthenes. The following algorithm will test whether N is prime. Write out the list of natural numbers from 2 up to N. Strike out all multiples of 2, except for 2. Strike out all multiples of the next remaining number except that number itself (this will be 3). Continue, at each step striking out all multiples of the next remaining number except that number itself. Stop when the next remaining number is > N.

Prime Numbers 54 Since we are striking out multiples we are only striking out composite numbers. Since every composite number m N has, by Proposition 6.8, a (prime) divisor m N, we will strike out every composite number N. Thus what will remain will be the non-composite numbers, i.e. the primes, between 2 and N. So, for example, if we look for primes up to 100 we need only check for divisibility by primes up to 100 = 10, i.e. 2, 3, 5 and 7. See PJE example 23.2.2 where this is done for N = 100. How many primes are there? Euclid was probably the first to prove, in his Elements, that there exist infinitely many prime numbers. 6.10. Theorem. (PJE theorem 23.5.1) There are infinitely many primes. Proof. PJE p.285 seems to say that Euclid proved this by contradiction this is not the case. Euclid s proof is closer to the following. Let p 1,..., p r be any finite list of primes. We will show that there is a prime not in this list. Let N = p 1 p 2... p r + 1. By the Fundamental Theorem of Arithmetic, N has a prime divisor, say q. Note that N is not divisible by any of p 1,..., p r, since N leaves remainder 1 when divided by p i ; yet N is divisible by q. Hence q is a prime not equal to any of p 1,..., p r. Note It needs to be stressed that this N may well not be prime. The first few N are N = 2 + 1 = 3, prime N = 2 3 + 1 = 7, prime, N = 2 3 5 + 1 = 31, prime N = 2 3 5 7 + 1 = 211, prime N = 2 3 5 7 11 + 1 = 2311, prime N = 2 3 5 7 11 13 + 1 = 30031 = 59 509, composite. The point of the proof is that the prime divisors of N will be previously unseen primes. Fermat s Little Theorem and applications 6.11. Lemma. If p is prime then p divides the binomial coefficient p 1. ( ) p for 1 r r

Proof. Recall that, whenever r is between 1 and p 1, Prime Numbers 55 ( ) ( ) p p 1 r = p r r 1 ( ) p (see Homework, Q10). Hence p r. But since 1 r < p, p does not divide r, so by r ( ) p Euclid s property of a prime (Theorem 6.5), p. r Remark. In your homework you were asked to show that n 5 n is divisibe by 5 for all n 1. The hint was to use induction and the Binomial Theorem on (k + 1) 5 which gives ( ) (k + 1) 5 = k 5 + 5k 4 + 10k 3 + 10k 2 + 5k + 1 k + 1 mod 5. The next Theorem generalises this. 6.12. Proposition. Freshman s Dream For all a, b Z and all primes p we have (a + b) p a p + b p mod p. p 1 ( ) p Proof By the Binomial Theorem, (a+b) p (a p +b p ) = a p r b r. By Lemma 6.11, r r=1 p divides every term on the right, hence p divides the whole sum, hence p (a + b) p (a p + b p ) as required. Now, just as ( ) can be used to prove n 5 n mod 5 for all n 1, Freshman s Dream can be used to prove the following general result. 6.13. Theorem. Fermat s Little Theorem (variant of PJE theorem 24.1.1) For all n Z, and all primes p, n p n mod p. If gcd (p, n) = 1 then n p 1 1 mod p.

Prime Numbers 56 Proof. We fix a prime p. We first prove that n p n mod p for non-negative n by induction in n. Base case: n = 0, 0 p 0 trivially. Inductive step: assume that k p k mod p. We need to prove (k + 1) p k + 1. Indeed, by Freshman s Dream, (k + 1) p k p + 1 mod p, which by inductive hypothesis is k + 1 mod p as required. So by induction n p n mod p for all n 0. Observe now that the result holds for all n Z: indeed, we proved that the congruence n p n mod p holds for n = 0, 1, 2,..., p 1 hence, by Modular Arithmetic, it holds for every n congruent, modulo p, to one of the numbers 0, 1, 2,..., p 1; but every integer is congruent, modulo p, to one of these residues. Now, to prove the second part of the theorem, write it as n n p 1 n 1 and assume that n is coprime to p. Then by Proposition 3.5 we can cancel n on both sides of the congruence to obtain n p 1 1 mod p. 6.14. Application: finding and using inverses. Fermat s Little Theorem has numerous applications, including simplifying the calculation of powers in modular arithmetic. From the theorem we see that if p is prime and p a then a p 1 1 mod p, or equivalently a p 2 a 1 mod p. This means that a p 2 is the inverse of a modulo p or, in the language of congruence classes, [a] 1 p = [ a p 2] p in Z p. Aside An interesting question is with which method is it quickest to calculate the modular inverse an integer modulo a prime. Is it by Euclid s Algorithm or by calculating a p 2 using, for example, the method of successive squaring? In fact, both methods have running time proportional to the number of decimal digits of a. For Euclid s algorithm this result on the running time is the content of Lame s Theorem, PJE p.226. End of aside We have seen before that a use of inverses is to solve linear congruences. 6.15. Example. Invert 5 mod 19. Hence solve the congruence 5x 6 mod 19. Solution 19 is prime so Fermat s Little theorem implies 5 18 1 mod 19. So 5 5 17 1 mod 19, i.e. 5 17 is the inverse of 5 mod 19. Thus multiplying both sides of the equation by 5 17 gives 5 18 x 6 5 17 mod 19, i.e. x 6 5 17 mod 19. Though this is an answer to the question we normally give x as the least positive residue. Successive squaring gives 5 2 6, 5 4 17, 5 8 4 and 5 16 16 mod 19.

Prime Numbers 57 Thus x 6 5 5 16 6 5 16 5 mod 19, which should still be checked by substitution. 6.16. Application: Calculating powers. With p = 13 and a = 4 we see that 4 12 1 mod 13. Thus 4 100 = 4 8 12+4 ( 4 12) 8 ( 4 2 ) 2 1 12 ( 3) 2 9 mod 13, as we have seen before in Chapter 3, using the method of successive squaring. Aside Fermat s Little Theorem may appear wonderful in that it helps us solve congruences and simplifies substantially the calculation of large powers modulo p. But the result has one weakness, you need to know that the modulus is prime. It should be stressed that it is a difficult problem showing that a large number is prime (primality testing). End of aside. 6.17. Application: Fermat pseudoprimes. Testing whether n is a prime using Sieve of Eratosthenes may cost up to n operations. This is prohibitively expensive for large n. A approach is known as Fermat pseudoprime test, but unfortunately it is randomised and may give a false prime with non-zero probability: Pick a random integer a between 2 and n; Use Euclid s algorithm to find d = gcd(a, n). If d > 1, n is composite (divisible by d) and we are done; otherwise, calculate a n 1 mod n using successive squaring; if a n 1 1 mod n, then by Fermat s Little Theorem n is not prime. Unfortunately, if we discover that a n 1 1 mod n, we will not know if n is prime or composite. Indeed, a n 1 1 mod n holds for all prime n but holds also for some composite n and some a coprime to n. The number of steps in Euclid s Algorithm and successive squaring is only of order log n which is much smaller than n. But it can happen that, even after picking several a, no contradiction is found, but n is still composite. See your homework for an example.

Prime Numbers 58 Euler s phi-function and Euler s Theorem Recall from the previous chapter that Z n is the set of invertible classes in Z n and that it can be written as {[r] n : 0 r n 1, gcd (r, n) = 1}. 6.18. Definition. Euler s phi-function is, for all n 1, given by φ (n) = Z n = {0 r n 1 : gcd (r, n) = 1}. Examples Simply by checking we see that φ (5) = 4 and φ (7) = 6. In general φ (p) = p 1 for all primes p since all positive integers strictly less than p are coprime to p. Also by checking, we find that φ (8) = 4 and φ (16) = 8. In general φ (2 n ) = 2 n 1 for all n 1, since in these cases we are counting the integers coprime to 2 n, i.e. the odd integers. And half of the integers up to 2 n are odd. And you can easily check by hand that φ (6) = 2, φ (9) = 6 and φ (10) = 4. 6.19. Proposition. a) Multiplicativity of φ: If gcd(m, n) = 1 then φ(mn) = φ(m)φ(n). b) If p is prime then for all r 1 φ (p r ) = p r 1 (p 1). Proof Warning: although the result is designated here as a proposition, the proof of a) is one of the most difficult proofs in the course. Idea of proof of part a): the set of integers a such that 0 a m 1 and a is coprime to m has cardinality φ(m), see the definition of φ(m). Likewise, there are φ(n) integers b coprime to n such that 0 b n 1. Hence there are φ(m)φ(n) pairs (a, b) where a and b satisfy the given constraints. We show that such pairs (a, b) are in bijection with the set of integers x such that 0 x mn 1 and x is coprime to mn. Since the latter set has φ(mn) elements, the existence of a bijection implies that φ(m)φ(n) = φ(mn). Most of the proof below is a formal argument showing that there is indeed a bijection. Crucially, we use the Chinese Remainder Theorem which assumes that m and n are coprime. End of idea.

Prime Numbers 59 Proof of a). In this proof, we will use the following sets of non-negative integers: M = {0, 1,..., m 1}, N = {0, 1,..., n 1}, MN = {0, 1,..., mn 1}. Assume that gcd(m, n) = 1. Then by Chinese Remainder Theorem 3.18, for each a M and b N there exists a unique integer in MN denote it x 0 (a, b) such that x 0 (a, b) a mod m and x 0 (a, b) b mod n. Hence we have a function x 0 : M N MN, (a, b) x 0 (a, b). The function x 0 is surjective: indeed, take x MN and let c the remainder of x modulo m (so that c M) and d be the remainder of x modulo n (so that d N). Then x c mod m and x d mod n, and x MN, which means that x = x 0 (c, d). Surjectivity of the function x 0 is proved. The set M N has cardinality m n, and the set MN has cardinality mn. A surjective function between two finite sets of the same cardinality is bijective. Hence the function x 0 is bijective. We will now restrict both the domain and the codomain of the function x 0 to obtain a bijective function between two non-trivial sets. The domain of the function x 0 is restricted to the set of pairs (a, b) M N such that a is coprime to m and b is coprime to n. The codomain of the function x 0 is restricted to the set of integers x MN such that x is coprime to mn. Of course we need to check that the function x 0 maps the new domain to the new codomain; that is, assuming that (a, b) M N is such that a is coprime to m and b is coprime to n, we need to show that x 0 (a, b) is coprime to mn. Indeed, since x 0 (a, b) a mod m and a is invertible mod m, we conclude that x 0 (a, b) is invertible mod m, i.e., is coprime to m. The same argument for b and n instead of a and m shows that x 0 (a, b) is coprime to n. Finally, if x 0 (a, b) is coprime to both m and n, then by homework question Q15, x 0 (a, b) is coprime to mn. Hence the resriction of x 0 is indeed a function (*) x 0 : {a : 0 a m 1, gcd(a, m) = 1} {b : 0 b n 1, gcd(b, n) = 1} {x : 0 x mn 1, gcd(x, mn) = 1}. Now, since the function x 0 is injective, its restriction (*) is injective. We claim that (*) is also surjective. To verify this claim, we assume that x = x 0 (a, b) is coprime to mn. We need to show that a is coprime to m and b is coprime to n. Indeed, if x is coprime to mn, then x is

Prime Numbers 60 coprime to m: any common divisor of x and m is also a common divisor of x and mn, the largest of which is 1. Hence x is invertible mod m, and since x = x 0 (a, b) a mod m, it follows that a is also invertible mod m, meanign that a is coprime to m. In the same way b is coprime to n. Thus, the function given by (*) is both injective and surjective, hence bijective. If a bijection exists between two sets, then the two sets have the same cardinality. It remains to observe that {a : 0 a m 1, gcd(a, m) = 1} {b : 0 b n 1, gcd(b, n) = 1} and = φ(m) φ(n) {x : 0 x mn 1, gcd(x, mn) = 1} = φ(mn). The two cardinalities are equal, so φ(m)φ(n) = φ(mn). b) See the homework questions for Week 12. Example. φ (100) = 40. Indeed, using Proposition 6.19, 100 = 2 2 5 2, 2 2 is coprime to 5 2 hence φ(100) = φ(2 2 )φ(5 2 ), φ(2 2 ) = 2 2 2 1 = 2, φ(5 2 ) = 5 2 5 1 = 20. The following is a generalization of Fermat s Little Theorem to composite moduli. 6.20. Theorem. Euler s Theorem If gcd (a, n) = 1 then a φ(n) 1 mod n. Proof is not in PJE s book, but the idea is to be found on p.290. Let us list the elements of Z n (i.e., invertible congruence classes mod n) as (List1) C 1, C 2,..., C φ(n) in some order. (Recall that Z n contains exactly φ(n) elements.) By Theorem 4.17, the product of elements of Z n is again an element of Z n, hence if X = C 1 C 2... C φ(n), then X Z n. By assumption, a is coprime to n, hence the residue class [a] n of a mod n belongs to the set Z n and is listed above as C i for some index i. Consider the following elements of Z n: (List2) C i C 1, C i C 2,..., C i C φ(n). This list is obtained by multiplying each entry of (List1) by C i.

Prime Numbers 61 We claim that all the entries in (List2) are distinct. Indeed, taking (List2) and multiplying all entries by Ci 1 gives (List1) which has φ(n) distinct entries. Hence (List2) also has φ(n) distinct entries, which means that the entries of (List2) are still all the elements of Z n, but possibly written in a different order. In particular, since multiplication on Z n is commutative (i.e., the product does not depend on the order in which the factors are written) the product of all the entries of (List2) is again X: X = (C i C 1 )(C i C 2 )... (C i C φ(n) ). Again using commutativity of multiplication, we rewrite this as X = C φ(n) i C 1 C 2... C φ(n). But this equation reads X = C φ(n) i X, which implies (multiplying through by X 1 ) that = [1] n. Recall that C i was the congruence class of a mod n, so that C φ(n) i [a φ(n) ] n = [1] n which merely means a φ(n) 1 mod n, as required. 6.21. Remark. Taking n = p, prime, in the Theorem we recover Fermat s Little Theorem. Indeed, φ(p) = p 1. 6.22. Example. Given φ (100) = 40 from above, find the last two digits in the decimal expansion of 2013 99. Solution We have to calculate 2013 99 mod 100 which is congruent to 13 99 mod 100. Euler s Theorem tells us that 13 φ(100) = 13 40 1 mod 100. Thus Now use successive squaring Hence 13 99 = ( 13 40) 2 13 19 1 2 13 19 13 19 mod 100. 13 2 69, 13 4 61, 13 8 21, 13 16 41 mod 100. 13 99 13 19 = 13 16 13 2 13 41 69 13 77 mod 100. So the last two digits of 13 99 are 77, as already found earlier.

Prime Numbers 62 Aside you may now think that Euler s Theorem has none of the problems of Fermat s Little Theorem as we do not need to know that the modulus m is prime; Euler s Theorem holds for all integers m. But unfortunately it has another problem, how to calculate φ (m)? In general this is very difficult for large m. Together, φ (st) = φ (s) φ (t) if gcd (s, t) = 1 and φ (p r ) = p r 1 (p 1) if p is prime, allow you to calculate φ (m) for any m provided you can factor m. Unfortunately, this is a very difficult problem for large m. Applications of Euler s and Fermat s Theorem. Not given in lectures. 6.23. Example. Find a solution to x 12 3 mod 11. Solution Any solution of this must satisfy gcd (x, 11) = 1 so Fermat s Little Theorem gives x 10 1 mod 11. Thus our equation becomes 3 x 12 x 2 x 10 x 2 mod 11. Now check. x x 2 mod 11 1 1 2 4 3 9 4 5 5 3 Note that if x 6 then 11 x 5 and x 2 (11 x) 2 mod 11 so all possible values of x 2 mod 11 will be seen in the table. From the table we see an answer is x 5 mod 11. 6.24. Example. Show that x 5 3 mod 11 has no solutions. Solution by contradiction. Assume x 5 3 mod 11 has solutions. Any solution of this must satisfy gcd (x, 11) = 1 so Fermat s Little Theorem gives x 10 1 mod 11. Since 5 10 we square both sides of the original congruence to get 1 x 10 ( x 5) 2 3 2 9 mod 11. This is false and so the assumption is false and thus the congruence has no solution.

Prime Numbers 63 6.25. Example. Find a solution to x 7 3 mod 11. Solution Again x 10 1 mod 11 by Fermat s Little Theorem but this time 7 10, in fact gcd (7, 10) = 1. From Euclid s Algorithm we get (3) 3 7 2 10 = 1. Raise both sides of the original congruence to the third power to get 3 3 ( x 7) 3 x 3 7 x 1+2 10 by (3), x ( x 10) 2 x mod 11. Hence a solution is x 3 3 5 mod 11. Don t forget to check your answer (by successive squaring of 5). iv) Is 2 35 + 1 divisible by 11? Here we look at 2 35 + 1 mod 11. Because 11 is prime we could use Fermat s Little Theorem to say 2 10 1 mod 11. Thus 2 35 + 1 2 5 + 1 32 + 1 = 33 0 mod 11, i.e. 2 35 + 1 is divisible by 11. Question for students. Show that 2 1194 + 1 is divisible by 65. Interesting problems concerning primes Not given in lectures. The following are conjectures and are all examples of problems that can be simply stated yet for which the answers are as yet unknown. 1) Goldbach s Conjecture, Is every even integer n 4 the sum of two primes? 4 = 2 + 2, 6 = 3 + 3, 8 = 3 + 5, 10 = 3 + 7, 12 = 5 + 7, 14 = 3 + 11, 16 = 3 + 13, 18 = 5 + 13, 20 = 7 + 13,... Has been checked for all even numbers up to 4 10 18 by Tomás Oliveira e Silva (as of 2017). Goldbach s Conjecture is a difficult problem because primes are multiplicative objects, defined in terms of divisibility, and yet this is an additive question. 2) Do there exist infinitely many Twin Primes, i.e. pairs of primes p and p such that p p = 2? The first few examples are (3, 5), (5, 7), (11, 13), (17, 19), (29, 31), (41, 43), (59, 61), (71, 73), (101, 103), (107, 109), (137, 139), (149, 151), (179, 181), (191, 193), (197, 199), (227, 229), (239, 241),....

Prime Numbers 64 A large prime pair is 2996863034895 2 1290000 ± 1, with 388,342 decimal digits. It was discovered in September 2016. It has recently been proved (2014) that there are infinitely many pairs of primes p < p (not necessarily consecutive) with p p < 246. 3) Is n 2 + 1 prime infinitely often? 2 2 + 1 = 5, 4 2 + 1 = 17, 6 2 + 1 = 37, 10 2 + 1 = 101, 14 2 + 1 = 197,... It has been shown that n 2 + 1 is either a prime or the product of two primes infinitely often. 4) For all m 1 does there exists a prime p : m 2 p (m + 1) 2? What is known is Theorem Bertrand s postulate: For all N 1 there exists a prime p : N p 2N. Proof. not given in course. 6.26. Definition. The Prime Counting Function If N Z, we define π(n) = {p Z : p N, p is prime}.