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

Size: px
Start display at page:

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

Transcription

1 Chapter 6 Prime Numbers Part VI of PJE. Definition and Fundamental Results Definition. (PJE definition ) An integer p is prime if p > 1 and p has exactly two positive divisors, 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. Lemma 6.1. An integer 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 is a positive divisor if n which is neither 1 nor n. Hence by definition, n is composite. Vice versa, if n is composite, then by definition 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 b = n/a. It remains to observe that 1 < b < n. Example. The first few prime numbers are 2, 3, 5, 7, 11, 13, 17, 19,... 56

2 Prime Numbers 57 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 77,232,917 1 with more than 23 million decimal digits, found in December 2017 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? Lemma 6.2. If p is prime, then for all integers a, either p a or p and a are coprime. Proof. PJE p.279. Let p be a prime and a be an integer. We assume that p a and prove that p is coprime to a. The only positive divisors of p are 1 and p. Out of these, p is not a divisor of a by assumption, so 1 is the only common positive divisor of p and a. Hence gcd(p, a) = 1, so p is coprime to a by definition of coprime. Proposition 6.3. (PJE proposition ) Every integer n 2 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. Inductive 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. Since k + 1 > 1, either k + 1 is a prime then it is a product of one prime, or k + 1 is composite then by Lemma 6.1, k + 1 = ab with 2 a, b k. By Inductive Hypothesis, a, b are products of primes, hence k + 1 = ab is also a product of primes. Conclusion: by strong induction, every integer n 2 is a product of primes. Theorem 6.4 (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 but we do not assume a, b to be positive) Let a, b Z. We assume that p ab and p a, and show that p b. By Lemma 6.2, p is coprime to a; but by assumption p ab, so by Corollary 2.5 p b, as required. Aside This result motivates the definition of a prime in more advanced work. End of aside

3 Prime Numbers 58 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.4, 6 is not prime. Corollary 6.5. 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 (proof not given in class). Now we can prove that the product of primes guaranteed by Proposition 6.3 is unique (up to ordering). Theorem 6.6 (Fundamental Theorem of Arithmetic). (PJE theorem ) 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.3. 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. (*) Note that r, s > 0, i.e., there is at least one prime on each side of this equation, because a product of primes cannot be equal to 1. Then p 1 q 1 q 2... q s so by Corollary 6.5 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 may appear 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.

4 Prime Numbers 59 Proposition 6.7 (PJE proposition ). If m is composite then m has a prime divisor not greater than 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. Application: Sieve of Eratosthenes The following method will test whether N is prime, and will generate all the prime numbers between 1 and N. Write out the list of natural numbers from 2 up to N. Strike out all multiples of 2, except for 2 itself. 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 greater than N. Since we are striking out multiples we are only striking out composite numbers. Since every composite number m N has, by Proposition 6.7, 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 where this is done for N = 100. How many primes are there? Euclid was probably the first to prove, in his Elements, the following statement. Theorem 6.8 (PJE theorem ). There are infinitely many primes.

5 Prime Numbers 60 Proof. PJE p.285. Assume for contradiction that there are finitely many primes, and list all primes as p 1,..., p r. Let N = p 1 p 2... p r + 1. Observe that N is not divisible by any prime, since N leaves remainder 1 when divided by p i for all i. Yet by the Fundamental Theorem of Arithmetic, N must be divisible by a prime, a contradiction. Note It needs to be stressed that this N may well not be prime. The first few N are N = = 3, prime N = = 7, prime, N = = 31, prime N = = 211, prime N = = 2311, prime N = = = , composite. The point of the proof is that the prime divisors of N will be previously unseen primes. Fermat s Little Theorem and applications Lemma 6.9. If p is prime then p divides the binomial coefficient Proof. Observe that, whenever r is between 1 and p 1, ( ) ( ) p p 1 r = p. r r 1 ( ) p for 1 r p 1. r r p! (p r)! r! = Indeed, by the Factorial Formula for the binomial coefficient, this translates as ( ) p (p 1)! p (p r)! (r 1)! which is true. 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.4), p. r 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.9, p r r=1 divides every term on the right, hence p divides the whole sum, hence p (a + b) p (a p + b p ) as required.

6 Prime Numbers 61 Theorem Fermat s Little Theorem (variant of PJE theorem ) For all n Z, and all primes p, If gcd (p, n) = 1 then n p n mod p. n p 1 1 mod p. 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.3 we can divide both sides of the congruence by n to obtain n p 1 1 mod p. 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?

7 Prime Numbers 62 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. Example. Invert 5 mod 19. Hence solve the congruence 5x 6 mod 19. Solution 19 is prime so Fermat s Little theorem implies mod 19. So mod 19, i.e is the inverse of 5 mod 19. Thus multiplying both sides of the equation by 5 17 gives 5 18 x mod 19, i.e. x 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, , and mod 19. Thus x mod 19, which should still be checked by substitution. Application: Calculating powers With p = 13 and a = 4 we see that mod 13. Thus = ( 4 12) 8 ( 4 2 ) ( 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.

8 Prime Numbers 63 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. 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}. Definition. Euler s phi-function is φ: N N given, for all n 1, by φ(n) = Z n = {r : 0 r n 1, gcd(r, n) = 1}. Example. Simply by checking we see that φ (5) = 4 and φ (7) = 6.

9 Prime Numbers 64 In general φ (p) = p 1 for all primes p since all positive integers strictly less than p are coprime to p by Lemma 6.2. 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. 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. a) See the homework questions for Week 12. Not examinable. b) We claim that the numbers not coprime to p r are multiples of p. Indeed, if x is not coprime to p r, that is, gcd(x, p r ) > 1, then gcd(x, p r ) is divisible by a prime, but the only prime which divides p r is p, hence p x. Vice versa, if p x then x is not coprime to p r. Among the first p r non-negative integers there are pr p integers divisible by p, therefore φ(p r ) = {0, 1,..., p r 1} \ {x : gcd(x, p r ) > 1} = p r {0, p, 2p,... } = p r p r 1. Corollary. If n = p k 1 1 pk pks s = s distinct primes, then i=1 p k i i φ(n) = is the prime factorisation of n, where p 1,..., p s are s i=1 p k i 1 i (p i 1). Proof. If s = 1, this is just part b) of the Proposition. Otherwise, p k 1 1 is coprime to s ( i=2 s ) φ(n) = φ(p k 1 1 )φ = p k (p 1 1) s i=2 p k i i i=2 use induction) to obtain the required formula. p k i i p k i i. Continue in the same way (more formally: Example. φ (100) = 40. Indeed, using Proposition 6.12, 100 = , 2 2 is coprime to 5 2 hence φ(100) = φ(2 2 )φ(5 2 ), φ(2 2 ) = = 2, φ(5 2 ) = = 20. so

10 Prime Numbers 65 The following is a generalization of Fermat s Little Theorem to composite moduli. 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. Claim. If gcd(a, n) = 1, then the function f : Z n Z n defined by the rule f ([x] n ) = [a] n [x] n is bijective. Proof of the claim: gcd(a, n) = 1 implies that the class [a] n Z n is invertible. Consider the function g : Z n Z n defined by g([x] n ) = [a] 1 n [x] n. Then f(g([x] n )) = g(f([x] n )) = [x] n for all [x] n Z n, hence g is the inverse function to f. A function which has an inverse is a bijection. The claim is proved. To prove Euler s Theorem, denote by X the product of all elements of Z n. X = [x] n Z n If we apply f to each factor in this product, we will get the same factors but perhaps in a [x] n. different order, because f is a bijection. Hence the product will not change: X = Therefore, by definition of the function f, X = [x] n Z n [x] n Z n f ([x] n ) ([a] n [x] n ) = [a] Z n n [x] n Z n Since X Z n, X has an inverse in Z n. Multiply through by X 1 : [x] n = [a] Z n n X. [a] Z n n = [1] n which is equivalent to a Z n 1 mod n. Theorem is proved. Since Z n = φ(n) by definition of φ(n), Euler s Remark. Taking n = p, prime, in the Theorem we recover Fermat s Little Theorem. Indeed, φ(p) = p 1.

11 Prime Numbers 66 Example. Given φ (100) = 40 from above, find the last two digits in the decimal expansion of Solution We have to calculate mod 100 which is congruent to mod 100. Euler s Theorem tells us that 13 φ(100) = mod 100. Thus Now use successive squaring Hence = ( 13 40) mod , , , mod = mod 100. So the last two digits of are 77, as already found earlier. 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. Example. Find a solution to x 12 3 mod 11.

12 Prime Numbers 67 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 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. 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) mod 11. This is false and so the assumption is false and thus the congruence has no solution. 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 = 1. (6.1) Raise both sides of the original congruence to the third power to get 3 3 ( x 7) 3 x 3 7 x by (6.1), x ( x 10) 2 x mod 11. Hence a solution is x mod 11.

13 Prime Numbers 68 Don t forget to check your answer (by successive squaring of 5). iv) Is divisible by 11? Here we look at mod 11. Because 11 is prime we could use Fermat s Little Theorem to say mod 11. Thus = 33 0 mod 11, i.e is divisible by 11. Question for students. Show that 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 = , 16 = , 18 = , 20 = ,... Has been checked for all even numbers up to 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),.... A large prime pair is ± 1, with 388,342 decimal digits. It was discovered in September It has recently been proved (2014) that there are infinitely many pairs of primes p < p (not necessarily consecutive) with p p < 246.

14 Prime Numbers 69 3) Is n prime infinitely often? = 5, = 17, = 37, = 101, = 197,... It has been shown that n 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. Definition. The Prime Counting Function If N Z, we define π(n) = {p Z : p N, p is prime}.

### CHAPTER 6. Prime Numbers. Definition and Fundamental Results

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

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

6 Prime Numbers Part VI of PJE 6.1 Fundamental Results Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively D (p) = { p 1 1 p}. Otherwise

### 7. Prime Numbers Part VI of PJE

7. Prime Numbers Part VI of PJE 7.1 Definition (p.277) A positive integer n is prime when n > 1 and the only divisors are ±1 and +n. That is D (n) = { n 1 1 n}. Otherwise n > 1 is said to be composite.

### 7.2 Applications of Euler s and Fermat s Theorem.

7.2 Applications of Euler s and Fermat s Theorem. i) Finding and using inverses. From Fermat s Little 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

### CHAPTER 3. Congruences. Congruence: definitions and properties

CHAPTER 3 Congruences Part V of PJE Congruence: definitions and properties Definition. (PJE definition 19.1.1) Let m > 0 be an integer. Integers a and b are congruent modulo m if m divides a b. We write

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

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald) 1 Euclid s Algorithm Euclid s Algorithm for computing the greatest common divisor belongs to the oldest known computing procedures

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

Math 324, Fall 2011 Assignment 7 Solutions Exercise 1. (a) Suppose a and b are both relatively prime to the positive integer n. If gcd(ord n a, ord n b) = 1, show ord n (ab) = ord n a ord n b. (b) Let

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

Exercise 23. (a) Solve the following congruences: (i) x 101 7 (mod 12) Answer. We have φ(12) = #{1, 5, 7, 11}. Since gcd(7, 12) = 1, we must have gcd(x, 12) = 1. So 1 12 x φ(12) = x 4. Therefore 7 12 x

### MATH 361: NUMBER THEORY FOURTH LECTURE

MATH 361: NUMBER THEORY FOURTH LECTURE 1. Introduction Everybody knows that three hours after 10:00, the time is 1:00. That is, everybody is familiar with modular arithmetic, the usual arithmetic of the

### 1 Overview and revision

MTH6128 Number Theory Notes 1 Spring 2018 1 Overview and revision In this section we will meet some of the concerns of Number Theory, and have a brief revision of some of the relevant material from Introduction

### Chapter 5. Modular arithmetic. 5.1 The modular ring

Chapter 5 Modular arithmetic 5.1 The modular ring Definition 5.1. Suppose n N and x, y Z. Then we say that x, y are equivalent modulo n, and we write x y mod n if n x y. It is evident that equivalence

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

CHAPTER 2 INTRODUCTION TO NUMBER THEORY ANSWERS TO QUESTIONS 2.1 A nonzero b is a divisor of a if a = mb for some m, where a, b, and m are integers. That is, b is a divisor of a if there is no remainder

### The Chinese Remainder Theorem

Chapter 5 The Chinese Remainder Theorem 5.1 Coprime moduli Theorem 5.1. Suppose m, n N, and gcd(m, n) = 1. Given any remainders r mod m and s mod n we can find N such that N r mod m and N s mod n. Moreover,

### LECTURE 4: CHINESE REMAINDER THEOREM AND MULTIPLICATIVE FUNCTIONS

LECTURE 4: CHINESE REMAINDER THEOREM AND MULTIPLICATIVE FUNCTIONS 1. The Chinese Remainder Theorem We now seek to analyse the solubility of congruences by reinterpreting their solutions modulo a composite

### Lecture 4: Number theory

Lecture 4: Number theory Rajat Mittal IIT Kanpur In the next few classes we will talk about the basics of number theory. Number theory studies the properties of natural numbers and is considered one of

### A SURVEY OF PRIMALITY TESTS

A SURVEY OF PRIMALITY TESTS STEFAN LANCE Abstract. In this paper, we show how modular arithmetic and Euler s totient function are applied to elementary number theory. In particular, we use only arithmetic

### M381 Number Theory 2004 Page 1

M81 Number Theory 2004 Page 1 [[ Comments are written like this. Please send me (dave@wildd.freeserve.co.uk) details of any errors you find or suggestions for improvements. ]] Question 1 20 = 2 * 10 +

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

The first exam will be on Monday, June 8, 202. The syllabus will be sections. and.2 in Lax, and the number theory handout found on the class web site, plus the handout on the method of successive squaring

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

Math 152, Problem Set 2 solutions (2018-01-24) All variables a, b, n, etc are integers unless otherwise stated. Each part of a problem is worth 5 points. 1. Let us look at the following equation: x 5 1

### A Guide to Arithmetic

A Guide to Arithmetic Robin Chapman August 5, 1994 These notes give a very brief resumé of my number theory course. Proofs and examples are omitted. Any suggestions for improvements will be gratefully

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

CS 5319 Advanced Discrete Structure Lecture 9: Introduction to Number Theory II Divisibility Outline Greatest Common Divisor Fundamental Theorem of Arithmetic Modular Arithmetic Euler Phi Function RSA

### 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

4. Primality testing 4.1. Introduction. Factorisation is concerned with the problem of developing efficient algorithms to express a given positive integer n > 1 as a product of powers of distinct primes.

### Euler s, Fermat s and Wilson s Theorems

Euler s, Fermat s and Wilson s Theorems R. C. Daileda February 17, 2018 1 Euler s Theorem Consider the following example. Example 1. Find the remainder when 3 103 is divided by 14. We begin by computing

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

BBM 205 Discrete Mathematics Hacettepe University http://web.cs.hacettepe.edu.tr/ bbm205 Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya Resources: Kenneth Rosen,

### PRIME NUMBERS YANKI LEKILI

PRIME NUMBERS YANKI LEKILI We denote by N the set of natural numbers: 1,2,..., These are constructed using Peano axioms. We will not get into the philosophical questions related to this and simply assume

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

PREFACE These notes have been prepared by Dr Mike Canfell (with minor changes and extensions by Dr Gerd Schmalz) for use by the external students in the unit PMTH 338 Number Theory. This booklet covers

### Basic elements of number theory

Cryptography Basic elements of number theory Marius Zimand 1 Divisibility, prime numbers By default all the variables, such as a, b, k, etc., denote integer numbers. Divisibility a 0 divides b if b = a

### Basic elements of number theory

Cryptography Basic elements of number theory Marius Zimand By default all the variables, such as a, b, k, etc., denote integer numbers. Divisibility a 0 divides b if b = a k for some integer k. Notation

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

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 9.1 Chapter 9 Objectives

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

ALGEBRA CHRISTIAN REMLING 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers by Z = {..., 2, 1, 0, 1,...}. Given a, b Z, we write a b if b = ac for some

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

2 Arithmetic This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}. (See [Houston, Chapters 27 & 28]) 2.1 Greatest common divisors Definition 2.16. If a, b are integers, we say

### 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?

Chapter 3: Theory of Modular Arithmetic 25 SECTION C Solving Linear Congruences By the end of this section you will be able to solve congruence equations determine the number of solutions find the multiplicative

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

NUMBER SYSTEMS Number theory is the study of the integers. We denote the set of integers by Z: Z = {..., 3, 2, 1, 0, 1, 2, 3,... }. The integers have two operations defined on them, addition and multiplication,

### Ma/CS 6a Class 2: Congruences

Ma/CS 6a Class 2: Congruences 1 + 1 5 (mod 3) By Adam Sheffer Reminder: Public Key Cryptography Idea. Use a public key which is used for encryption and a private key used for decryption. Alice encrypts

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

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers Solutions Warm-up Problems 1. What is a prime number? Give an example of an even prime number and an odd prime number. A prime number

### Lecture Notes. Advanced Discrete Structures COT S

Lecture Notes Advanced Discrete Structures COT 4115.001 S15 2015-01-13 Recap Divisibility Prime Number Theorem Euclid s Lemma Fundamental Theorem of Arithmetic Euclidean Algorithm Basic Notions - Section

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

Questions/Complaints About Homework? Here s the procedure for homework questions/complaints: 1. Read the solutions first. 2. Talk to the person who graded it (check initials) 3. If (1) and (2) don t work,

### NOTES ON SIMPLE NUMBER THEORY

NOTES ON SIMPLE NUMBER THEORY DAMIEN PITMAN 1. Definitions & Theorems Definition: We say d divides m iff d is positive integer and m is an integer and there is an integer q such that m = dq. In this case,

### 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?

2 Mod math Modular arithmetic is the math you do when you talk about time on a clock. For example, if it s 9 o clock right now, then it ll be 1 o clock in 4 hours. Clearly, 9 + 4 1 in general. But on a

### 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,

SOLUTIONS TO PROBLEM SET 1 Section 1.3 Exercise 4. We see that 1 1 2 = 1 2, 1 1 2 + 1 2 3 = 2 3, 1 1 2 + 1 2 3 + 1 3 4 = 3 4, and is reasonable to conjecture n k=1 We will prove this formula by induction.

### Part II. Number Theory. Year

Part II Year 2017 2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2017 Paper 3, Section I 1G 70 Explain what is meant by an Euler pseudoprime and a strong pseudoprime. Show that 65 is an Euler

### Introduction to Public-Key Cryptosystems:

Introduction to Public-Key Cryptosystems: Technical Underpinnings: RSA and Primality Testing Modes of Encryption for RSA Digital Signatures for RSA 1 RSA Block Encryption / Decryption and Signing Each

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

Fermat s Little Theorem Fermat s little theorem is a statement about primes that nearly characterizes them. Theorem: Let p be prime and a be an integer that is not a multiple of p. Then a p 1 1 (mod p).

### 1. multiplication is commutative and associative;

Chapter 4 The Arithmetic of Z In this chapter, we start by introducing the concept of congruences; these are used in our proof (going back to Gauss 1 ) that every integer has a unique prime factorization.

### Discrete Mathematics with Applications MATH236

Discrete Mathematics with Applications MATH236 Dr. Hung P. Tong-Viet School of Mathematics, Statistics and Computer Science University of KwaZulu-Natal Pietermaritzburg Campus Semester 1, 2013 Tong-Viet

### Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory.

CSS322: Security and Cryptography Sirindhorn International Institute of Technology Thammasat University Prepared by Steven Gordon on 29 December 2011 CSS322Y11S2L06, Steve/Courses/2011/S2/CSS322/Lectures/number.tex,

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

Math 4161 Dr. Franz Rothe December 9, 2013 13FALL\4161_fall13f.tex Name: Use the back pages for extra space Final 70 70 Problem 1. The following assertions may be true or false, depending on the choice

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

MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences. Congruences Let n be a postive integer. The integers a and b are called congruent modulo n if they have the same

### Introduction to Number Theory

INTRODUCTION Definition: Natural Numbers, Integers Natural numbers: N={0,1,, }. Integers: Z={0,±1,±, }. Definition: Divisor If a Z can be writeen as a=bc where b, c Z, then we say a is divisible by b or,

### MATH 2200 Final Review

MATH 00 Final Review Thomas Goller December 7, 01 1 Exam Format The final exam will consist of 8-10 proofs It will take place on Tuesday, December 11, from 10:30 AM - 1:30 PM, in the usual room Topics

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

PREPARATION NOTES FOR NUMBER THEORY PRACTICE WED. OCT. 3,2012 0.1. Basic Num. Th. Techniques/Theorems/Terms. Modular arithmetic, Chinese Remainder Theorem, Little Fermat, Euler, Wilson, totient, Euclidean

### Math 109 HW 9 Solutions

Math 109 HW 9 Solutions Problems IV 18. Solve the linear diophantine equation 6m + 10n + 15p = 1 Solution: Let y = 10n + 15p. Since (10, 15) is 5, we must have that y = 5x for some integer x, and (as we

### A Few Primality Testing Algorithms

A Few Primality Testing Algorithms Donald Brower April 2, 2006 0.1 Introduction These notes will cover a few primality testing algorithms. There are many such, some prove that a number is prime, others

### Ma/CS 6a Class 2: Congruences

Ma/CS 6a Class 2: Congruences 1 + 1 5 (mod 3) By Adam Sheffer Reminder: Public Key Cryptography Idea. Use a public key which is used for encryption and a private key used for decryption. Alice encrypts

### Beautiful Mathematics

Beautiful Mathematics 1. Principle of Mathematical Induction The set of natural numbers is the set of positive integers {1, 2, 3,... } and is denoted by N. The Principle of Mathematical Induction is a

### Chapter 5: The Integers

c Dr Oksana Shatalov, Fall 2014 1 Chapter 5: The Integers 5.1: Axioms and Basic Properties Operations on the set of integers, Z: addition and multiplication with the following properties: A1. Addition

### 5: The Integers (An introduction to Number Theory)

c Oksana Shatalov, Spring 2017 1 5: The Integers (An introduction to Number Theory) The Well Ordering Principle: Every nonempty subset on Z + has a smallest element; that is, if S is a nonempty subset

### 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?

Chapter 3: Theory of Modular Arithmetic 25 SECTION C Solving Linear Congruences By the end of this section you will be able to solve congruence equations determine the number of solutions find the multiplicative

### Solution Sheet (i) q = 5, r = 15 (ii) q = 58, r = 15 (iii) q = 3, r = 7 (iv) q = 6, r = (i) gcd (97, 157) = 1 = ,

Solution Sheet 2 1. (i) q = 5, r = 15 (ii) q = 58, r = 15 (iii) q = 3, r = 7 (iv) q = 6, r = 3. 2. (i) gcd (97, 157) = 1 = 34 97 21 157, (ii) gcd (527, 697) = 17 = 4 527 3 697, (iii) gcd (2323, 1679) =

### With Question/Answer Animations. Chapter 4

With Question/Answer Animations Chapter 4 Chapter Motivation Number theory is the part of mathematics devoted to the study of the integers and their properties. Key ideas in number theory include divisibility

### Part IA Numbers and Sets

Part IA Numbers and Sets Theorems Based on lectures by A. G. Thomason Notes taken by Dexter Chua Michaelmas 2014 These notes are not endorsed by the lecturers, and I have modified them (often significantly)

### 4. Congruence Classes

4 Congruence Classes Definition (p21) The congruence class mod m of a Z is Example With m = 3 we have Theorem For a b Z Proof p22 = {b Z : b a mod m} [0] 3 = { 6 3 0 3 6 } [1] 3 = { 2 1 4 7 } [2] 3 = {

### Part IA Numbers and Sets

Part IA Numbers and Sets Definitions Based on lectures by A. G. Thomason Notes taken by Dexter Chua Michaelmas 2014 These notes are not endorsed by the lecturers, and I have modified them (often significantly)

### Contest Number Theory

Contest Number Theory Andre Kessler December 7, 2008 Introduction Number theory is one of the core subject areas of mathematics. It can be somewhat loosely defined as the study of the integers. Unfortunately,

### 3.7 Non-linear Diophantine Equations

37 Non-linear Diophantine Equations As an example of the use of congruences we can use them to show when some Diophantine equations do not have integer solutions This is quite a negative application -

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

Introduction to Algorithms (CS 482) Cornell University Instructor: Bobby Kleinberg Lecture Notes, 25 April 2008 The Miller-Rabin Randomized Primality Test 1 Introduction Primality testing is an important

### An Algorithm for Prime Factorization

An Algorithm for Prime Factorization Fact: If a is the smallest number > 1 that divides n, then a is prime. Proof: By contradiction. (Left to the reader.) A multiset is like a set, except repetitions are

### 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

LARGE PRIME NUMBERS 1. Fermat Pseudoprimes Fermat s Little Theorem states that for any positive integer n, if n is prime then b n % n = b for b = 1,..., n 1. In the other direction, all we can say is that

### PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

PUTNAM TRAINING NUMBER THEORY (Last updated: December 11, 2017) Remark. This is a list of exercises on Number Theory. Miguel A. Lerma Exercises 1. Show that the sum of two consecutive primes is never twice

### For your quiz in recitation this week, refer to these exercise generators:

Monday, Oct 29 Today we will talk about inverses in modular arithmetic, and the use of inverses to solve linear congruences. For your quiz in recitation this week, refer to these exercise generators: GCD

### ECE596C: Handout #11

ECE596C: Handout #11 Public Key Cryptosystems Electrical and Computer Engineering, University of Arizona, Loukas Lazos Abstract In this lecture we introduce necessary mathematical background for studying

### God may not play dice with the universe, but something strange is going on with the prime numbers.

Primes: Definitions God may not play dice with the universe, but something strange is going on with the prime numbers. P. Erdös (attributed by Carl Pomerance) Def: A prime integer is a number whose only

### MATH 4400 SOLUTIONS TO SOME EXERCISES. 1. Chapter 1

MATH 4400 SOLUTIONS TO SOME EXERCISES 1.1.3. If a b and b c show that a c. 1. Chapter 1 Solution: a b means that b = na and b c that c = mb. Substituting b = na gives c = (mn)a, that is, a c. 1.2.1. Find

### 1 Structure of Finite Fields

T-79.5501 Cryptology Additional material September 27, 2005 1 Structure of Finite Fields This section contains complementary material to Section 5.2.3 of the text-book. It is not entirely self-contained

### Theory of Numbers Problems

Theory of Numbers Problems Antonios-Alexandros Robotis Robotis October 2018 1 First Set 1. Find values of x and y so that 71x 50y = 1. 2. Prove that if n is odd, then n 2 1 is divisible by 8. 3. Define

### CPSC 467: Cryptography and Computer Security

CPSC 467: Cryptography and Computer Security Michael J. Fischer Lecture 9 September 30, 2015 CPSC 467, Lecture 9 1/47 Fast Exponentiation Algorithms Number Theory Needed for RSA Elementary Number Theory

### MATH 310: Homework 7

1 MATH 310: Homework 7 Due Thursday, 12/1 in class Reading: Davenport III.1, III.2, III.3, III.4, III.5 1. Show that x is a root of unity modulo m if and only if (x, m 1. (Hint: Use Euler s theorem and

### Congruence of Integers

Congruence of Integers November 14, 2013 Week 11-12 1 Congruence of Integers Definition 1. Let m be a positive integer. For integers a and b, if m divides b a, we say that a is congruent to b modulo m,

### Theoretical Cryptography, Lecture 13

Theoretical Cryptography, Lecture 13 Instructor: Manuel Blum Scribe: Ryan Williams March 1, 2006 1 Today Proof that Z p has a generator Overview of Integer Factoring Discrete Logarithm and Quadratic Residues

### 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.

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

### Chapter 5. Number Theory. 5.1 Base b representations

Chapter 5 Number Theory The material in this chapter offers a small glimpse of why a lot of facts that you ve probably nown and used for a long time are true. It also offers some exposure to generalization,

### Summary Slides for MATH 342 June 25, 2018

Summary Slides for MATH 342 June 25, 2018 Summary slides based on Elementary Number Theory and its applications by Kenneth Rosen and The Theory of Numbers by Ivan Niven, Herbert Zuckerman, and Hugh Montgomery.

### Primes. Rational, Gaussian, Industrial Strength, etc. Robert Campbell 11/29/2010 1

Primes Rational, Gaussian, Industrial Strength, etc Robert Campbell 11/29/2010 1 Primes and Theory Number Theory to Abstract Algebra History Euclid to Wiles Computation pencil to supercomputer Practical

### Number Theory Homework.

Number Theory Homewor. 1. The Theorems of Fermat, Euler, and Wilson. 1.1. Fermat s Theorem. The following is a special case of a result we have seen earlier, but as it will come up several times in this

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

Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography David R. Wilkins Copyright c David R. Wilkins 2000 2013 Contents 9 Introduction to Number Theory 63 9.1 Subgroups

### Number Theory and Algebra: A Brief Introduction

Number Theory and Algebra: A Brief Introduction Indian Statistical Institute Kolkata May 15, 2017 Elementary Number Theory: Modular Arithmetic Definition Let n be a positive integer and a and b two integers.

### I Foundations Of Divisibility And Congruence 1

Contents I Foundations Of Divisibility And Congruence 1 1 Divisibility 3 1.1 Definitions............................. 3 1.2 Properties Of Divisibility..................... 5 1.3 Some Basic Combinatorial

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

CS 70 Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6 1 Modular Arithmetic In several settings, such as error-correcting codes and cryptography, we sometimes

### Integers and Division

Integers and Division Notations Z: set of integers N : set of natural numbers R: set of real numbers Z + : set of positive integers Some elements of number theory are needed in: Data structures, Random

### EULER S THEOREM KEITH CONRAD

EULER S THEOREM KEITH CONRAD. Introduction Fermat s little theorem is an important property of integers to a prime modulus. Theorem. (Fermat). For prime p and any a Z such that a 0 mod p, a p mod p. If

### 4 Number Theory and Cryptography

4 Number Theory and Cryptography 4.1 Divisibility and Modular Arithmetic This section introduces the basics of number theory number theory is the part of mathematics involving integers and their properties.

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

MATH 11/CSCI 11, Discrete Structures I Winter 007 Toby Kenney Homework Sheet 5 Hints & Model Solutions Sheet 4 5 Define the repeat of a positive integer as the number obtained by writing it twice in a

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

COMP239: Mathematics for Computer Science II Prof. Chadi Assi assi@ciise.concordia.ca EV7.635 The Euclidean Algorithm The Euclidean Algorithm Finding the GCD of two numbers using prime factorization is

### Number Theory Proof Portfolio

Number Theory Proof Portfolio Jordan Rock May 12, 2015 This portfolio is a collection of Number Theory proofs and problems done by Jordan Rock in the Spring of 2014. The problems are organized first by

### Chuck Garner, Ph.D. May 25, 2009 / Georgia ARML Practice

Some Chuck, Ph.D. Department of Mathematics Rockdale Magnet School for Science Technology May 25, 2009 / Georgia ARML Practice Outline 1 2 3 4 Outline 1 2 3 4 Warm-Up Problem Problem Find all positive

### 2 More on Congruences

2 More on Congruences 2.1 Fermat s Theorem and Euler s Theorem definition 2.1 Let m be a positive integer. A set S = {x 0,x 1,,x m 1 x i Z} is called a complete residue system if x i x j (mod m) whenever

### Homework 3, solutions

Homework 3, solutions Problem 1. Read the proof of Proposition 1.22 (page 32) in the book. Using simialr method prove that there are infinitely many prime numbers of the form 3n 2. Solution. Note that

### 8 Primes and Modular Arithmetic

8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.