7. Prime Numbers Part VI of PJE

Size: px
Start display at page:

Download "7. Prime Numbers Part VI of PJE"

Transcription

1 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. So n > 1 is composite if and only if there exist integers a > 1 and b > 1 such that n = ab. Example The first few prime numbers are Note that it is an extremely hard problem to prove that a given large integer (say with 150 digits) is prime which is exactly what is required to break present day codes. But some very large primes are known such as with digits found by Edson Smith George Woltman Scott Kurowski et al. in 2008 Question What is the connection with the earlier definition of coprime? Lemma If p is prime and p a then p and a are coprime. Recall Two integers m and n are coprime if gcd (m n) = 1. Here gcd (m n) = max D (m n) = max D (m) D (n). Proof By the recollection gcd (p a) = max D (a) D (p). Because p is prime we have D (p) = { p 1 1 p} and so D (a) D (p) { p 1 1 p}. But p a and so p / D (a) and also p / D (a). Thus D (a) D (p) { 1 1}. Yet 1 1 D (n) for any integer n. Hence D (a) D (p) = { 1 1}. Finally therefore gcd (p a) = max D (a) D (p) = 1. 1

2 Theorem Every integer n > 1 is a product of primes. (With the convention that a product could be of just one prime!) Proof p.278 is by strong induction Theorem (Euclid) If p ab then either p a or p b. Proof p.279. The proof makes use of an earlier result that if n ab and gcd (n a) = 1 then n b. Example yet 12 4 and This proves that 12 is not prime! Euclid s Theorem motivates the definition of a prime in more advanced work. Thus p is prime iff for all integers a b p ab implies either p a or p b. Corollary If p a 1 a 2...a n then p a i for some 1 i n. Proof p a 1 a 2...a n p a 1 (a 2...a n ) which by the Theorem implies that either p a 1 or p a 2...a n. If p a 1 we are finished. If p a 2...a n repeat the process. Theorem Fundamental Theorem of Arithmetic. Every positive integer greater than 1 can be written as a product of primes unique up to ordering i.e. for all n 2 n = p 1 p 2...p r where each p i (i = 1... r) is a prime. Proof p.283 is by contradiction Note the similarities between this and the result that permutations in S n can be written as a product of disjoint cycles unique up to ordering. Aside I It must be stressed that it is a very hard problem to find the prime decomposition of large numbers. What do I mean by large? A 232 digit was factored on December : =

3 See numbers. Question How to find primes? Theorem If m is composite then m has a prime divisor not exceeding m i.e. m composite prime p s.t. p m and p m. Proof p.280 is by contradiction. An application of this result is to finding primes. In this method we disgard composite numbers leaving only primes. And how do you know a number m is composite? It is a multiple of an integer (in fact a prime - but that is not important) m. And if we are disgarding composites m less that N then it will be a multiple of an integer m N. Thus we discard the multiples of integers N. Application Sieve of Eratosthenes Write out the list of natural numbers 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. You will now have a list of primes up to 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 and 7. See appendix 7-i where this is carried out for N = 100. Question How many primes are there? Theorem There are infinitely many primes. Proof (due to Euler) p.285 is by contradiction. Note The first few examples of p 1 p 2..p r + 1 where p 1 < p 2 <... < p r are the first r primes are = = = =

4 are all primes. But the next one is not: = = Interesting problems concerning primes. 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 = = = = = = = = = Has been checked for all even numbers up to by Oliveira e Silva (July ). 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) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ).... A large prime pair is ± 1 with digits discovered by Kaiser1 & Klahn in ) Is n is prime infinitely often? = = = = = ) For all m 1 does there exists a prime p : m 2 p (m + 1) 2? What is known is Theorem Bertrand s postulate: p : N p 2N. Proof not given in course. For all N 1 there exists a prime 4

5 Binomial Theorem for prime powers Recall that the Binomial Coefficient ( n r) can be expressed as ( ) n = r n! r! (n r)!. Theorem If p is prime then p divides ( p r) i.e. ( ) p p r for 1 r p 1. Proof Since p! = p (p 1)! we have that p p!. If p r! then since p is prime the Corollary above implies that p m for some m in the product r! which means m r p 1. But p m means p m and thus p m p 1 which is a contradiction. Hence p r!. Similarly since p r p 1 we get p (p r)!. Hence p p! yet p r! (p r)! and so p p! r! (p r)! = ( ) p. r Theorem For all a b Z and all primes p we have Proof By the Binomial Theorem (a + b) p = (a + b) p a p + b p mod p. p ( ) p a p r b r r r=0 p 1 ( ) p = a p + a p r b r + b p r r=1 a p + b p mod p using the previous Theorem on all terms of the sum. 5

6 Corollary (Fermat s Little Theorem) For all n 1 and all primes p If gcd (p n) = 1 then Proof by induction. n p n mod p. n p 1 1 mod p. Base case n = 1. 1 p = 1 and so the result holds with equality. Assume the result holds for n = k so k p k mod p. Consider now m = k + 1. Then by the previous Theorem m p = (k + 1) p k p + 1 mod p k + 1 mod p by the inductive hypothesis = m mod p. Thus the result holds for m = k + 1. Hence by induction the result holds for all m 1 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 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. An interesting question is with which method is it quickest to calculate the modular inverse. 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. A use of inverses is to solve linear congruences. Example Find the integer solutions of 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. 6

7 Though this is an answer to the question we normally give x as the least positive residue. Successive squaring gives Thus ( 2) 2 4 and mod 19. x mod 19 which agrees with the answer found in Chapter 3 but which should still be checked by substitution. 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. Note 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 two weaknesses. First it only applies to prime modulus. You can often overcome this by using the Chinese Remainder Theorem. The second weekeness is that you need to know that the modulus is prime. It is a very difficult problem showing that a large number is prime. The largest known prime (as of September 2008) is (See for further details). 7

8 Permutations on Z n. 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 : 1 r n gcd (r n) = 1} which because we can take different labels for the classes is the same as {[r] n : 0 r n 1 gcd (r n) = 1}. Definition* Euler s phi-function is for all n 1 given by φ (n) = Z n = {1 r n : gcd (r n) = 1} = {0 r n 1 : gcd (r n) = 1} Examples Simply by checking we see that and φ (5) = { } = 4 φ (7) = { } = 6. In general φ (p) = p 1 for all primes p since all integers strictly less than p are coprime to p. Also by checking φ (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. Example What is φ (100)? Solution Start from φ (100) = {0 n 99 : gcd (n 100) = 1}. Then every 0 n 99 can be written uniquely as Note that n = r + s10 with 0 r 9 and 0 s 9. gcd (n 100) = 1 2 n and 5 n 2 (r + s10) and 5 (r + s10) 2 r and 5 r gcd (r 10) = 1. 8

9 Hence φ (100) = {0 r 9 0 s 9 : gcd (r 10) = 1} = 10 {0 r 9 : gcd (r 10) = 1} since there are 10 choices for s = 10 φ (10) = 40. Question for students. What is φ (1000)? Theorem If gcd (a n) = 1 then the function is a permutation. ρ a : Z n Z n [r] n [ar] n Proof The idea for the proof can be seen on p.259 and p.290. Is ρ a well-defined? Does ρ a map into Z n as claimed in the definition of ρ a? If [r] n Z n then gcd (r n) = 1 by definition of Z n. By the assumption in the theorem we have gcd (a n) = 1. Recall that two integers w v are coprime i.e. gcd (w v) = 1 if and only if there exist integers s and t such that 1 = sw + tv. Thus gcd (r n) = 1 s t Z such that 1 = sr + tn gcd (a n) = 1 k l Z such that 1 = ka + ln. Combine these two equalities as 1 = sr 1 + tn = sr (ka + ln) + tn = (sk) ra + (srl + t) n which gives gcd (ar n) = 1. Thus [ar] n Z n and so for every [r] n Z n the image ρ a ([r] n ) is in Z n and the function ρ a is well-defined. Is ρ a a permutation? So is ρ a a bijection from Z n to Z n? The easiest way to check this is to find the inverse map. Since gcd (a n) = 1 there exists an element a 1 such that a 1 a 1 aa 1 mod n. Then we claim that ρ a 1 is the inverse function. To see this note that for [r] n Z n we have (ρ a 1 ρ a ) [r] n = ρ a 1 (ρ a [r] n ) = ρ a 1 [ar] n = [ a 1 ar ] n = [r] n. 9

10 Similarly (ρ a ρ a 1) [r] n = ρ a (ρ a 1 [r] n ) = ρ a [ a 1 r ] n = [ aa 1 r ] n = [r] n. And thus ρ a 1 is the inverse function ρ a a bijection from Z n to Z n and hence ρ a a permutation. Example On Z 8 = { } consider ρ 3. ρ 3 ([1] 8 ) = [3] 8 ρ 3 ([3] 8 ) = [9] 8 = [1] 8 ρ 3 ([5] 3 ) = [15] 8 = [7] 8 ρ 3 ([7] 8 ) = [21] 8 = [5] 8. Dropping the [...] 8 we can represent this as ( ) ρ 3 = = (1 3) (5 7) The other three permutations are ( ) ρ 1 = = Z 8 ( ) ρ 5 = = (1 5) (3 7) ( ) ρ 7 = = (1 7) (3 5) 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. Since ρ a is a permutation of Z n then the image of ρ a is simply Z n in some different order. Since order is immaterial in sets we have Z n = Im ρ a i.e. {[r] n : 1 r n 1 gcd (r n) = 1} = {[ar] n : 1 r n 1 gcd (r n) = 1}. 10

11 Taking products of everything in each set we get [r] n = [ar] n = 1 r n 1 gcd(rn)=1 1 r n 1 gcd(rn)=1 1 r n 1 gcd(rn)=1 ([a] n [r] n ) by definition of multiplication in Z n = [a] φ(n) n [r] n 1 r n 1 gcd(rn)=1 since there are φ (n) terms in the product. Now cancel the product from both sides to get [1] n = [a] φ(n) n = [ a φ(n)] n again by the definition of the multiplication of classes. But this final result merely means a φ(n) 1 mod n as required. Example of the method of proof of Euler s Theorem. Z 8 = {[1] 8 [3] 8 [5] 8 [7] 8 } and so φ (8) = 4. Take a = 5 in which case the map ρ 5 is Then [1] 8 [5 1] 8 = [5] 8 [3] 8 [5 3] 8 = [7] 8 [5] 8 [5 5] 8 = [1] 8 [7] 8 [5 7] 8 = [3] 8. [1] 8 [3] 8 [5] 8 [7] 8 = [5 1] 8 [5 3] 8 [5 5] 8 [5 7] 8 = [5] 4 8 [1] 8 [3] 8 [5] 8 [7] 8 Canceling [1] 8 [3] 8 [5] 8 [7] 8 from both sides leaves [5] 4 8 = [1] 8. Thus mod 8 as expected. Taking n = p prime in the Theorem we again get Theorem Fermat s Little Theorem If p is prime and a an integer with p a then a p 1 1 mod p. (1) 11

12 Proof p.290 Corollary If p is prime and a an integer then a p a mod p. Proof Either p a or p a. In the first case Fermat s Little Theorem implies a p 1 1 mod p. Multiply by a to get a p a mod p. in the second case p a and so a 0 mod p. But then a p 1 0 mod p and so a p 1 0 a mod p. In both cases we have a p a mod p. Example Find the last two digits in the decimal expansion of Solution We have to calculate mod 100. Euler s Theorem tells us that 13 φ(100) = mod 10. Thus Now use successive squaring Hence = ( 13 40) mod (2) mod = mod 100. So the last two digits of are 77 as already found in Chapter 3. Note you may now think that Euler s Theorem has none of the problems of Fermat s Little Theorem as we do not have to know that the modulus m is prime Euler s Theorem holds for all integer m. But unfortunately it has another problem how to calculate φ (m)? In general this is very difficult for large m. It can be shown that if m = pq the product of different primes then φ (m) = φ (p) φ (q) = (p 1) (q 1). But to be able to do this we need to factorise m and that is the difficulty. In general the calculating of φ (m) is as hard as factorising m. 12

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

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

More information

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

An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p. Chapter 6 Prime Numbers Part VI of PJE. Definition and Fundamental Results Definition. (PJE definition 23.1.1) An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p. If n > 1

More information

CHAPTER 6. Prime Numbers. Definition and Fundamental Results

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

More information

7.2 Applications of Euler s and Fermat s Theorem.

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

More information

CHAPTER 3. Congruences. Congruence: definitions and properties

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

More information

4. Congruence Classes

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 = {

More information

4 Number Theory and Cryptography

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.

More information

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

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

More information

Number Theory. Modular Arithmetic

Number Theory. Modular Arithmetic Number Theory The branch of mathematics that is important in IT security especially in cryptography. Deals only in integer numbers and the process can be done in a very fast manner. Modular Arithmetic

More information

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

More information

3 The fundamentals: Algorithms, the integers, and matrices

3 The fundamentals: Algorithms, the integers, and matrices 3 The fundamentals: Algorithms, the integers, and matrices 3.4 The integers and division This section introduces the basics of number theory number theory is the part of mathematics involving integers

More information

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?

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

More information

Number Theory Homework.

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

More information

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 (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) =

More information

Chapter 5. Modular arithmetic. 5.1 The modular ring

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

More information

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

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

More information

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

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

More information

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

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

More information

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

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

More information

The Chinese Remainder Theorem

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,

More information

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

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

More information

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

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

More information

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

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

More information

PRIME NUMBERS YANKI LEKILI

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

More information

Lecture 4: Number theory

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

More information

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

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

More information

Solutions to Assignment 1

Solutions to Assignment 1 Solutions to Assignment 1 Question 1. [Exercises 1.1, # 6] Use the division algorithm to prove that every odd integer is either of the form 4k + 1 or of the form 4k + 3 for some integer k. For each positive

More information

* 8 Groups, with Appendix containing Rings and Fields.

* 8 Groups, with Appendix containing Rings and Fields. * 8 Groups, with Appendix containing Rings and Fields Binary Operations Definition We say that is a binary operation on a set S if, and only if, a, b, a b S Implicit in this definition is the idea that

More information

Introduction to Number Theory

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,

More information

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?

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

More information

1 Overview and revision

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

More information

3.7 Non-linear Diophantine Equations

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 -

More information

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

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,

More information

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

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,

More information

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

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

More information

Basic elements of number theory

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

More information

Basic elements of number theory

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

More information

A SURVEY OF PRIMALITY TESTS

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

More information

Solutions to Practice Final

Solutions to Practice Final s to Practice Final 1. (a) What is φ(0 100 ) where φ is Euler s φ-function? (b) Find an integer x such that 140x 1 (mod 01). Hint: gcd(140, 01) = 7. (a) φ(0 100 ) = φ(4 100 5 100 ) = φ( 00 5 100 ) = (

More information

Part IA Numbers and Sets

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)

More information

Chapter 5: The Integers

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

More information

[Part 2] Asymmetric-Key Encipherment. Chapter 9. Mathematics of Cryptography. Objectives. Contents. Objectives

[Part 2] Asymmetric-Key Encipherment. Chapter 9. Mathematics of Cryptography. Objectives. Contents. Objectives [Part 2] Asymmetric-Key Encipherment Mathematics of Cryptography Forouzan, B.A. Cryptography and Network Security (International Edition). United States: McGraw Hill, 2008. Objectives To introduce prime

More information

The Chinese Remainder Theorem

The Chinese Remainder Theorem The Chinese Remainder Theorem R. C. Daileda February 19, 2018 1 The Chinese Remainder Theorem We begin with an example. Example 1. Consider the system of simultaneous congruences x 3 (mod 5), x 2 (mod

More information

3.2 Solving linear congruences. v3

3.2 Solving linear congruences. v3 3.2 Solving linear congruences. v3 Solving equations of the form ax b (mod m), where x is an unknown integer. Example (i) Find an integer x for which 56x 1 mod 93. Solution We have already solved this

More information

5: The Integers (An introduction to Number Theory)

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

More information

Part IA Numbers and Sets

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)

More information

6 Permutations Very little of this section comes from PJE.

6 Permutations Very little of this section comes from PJE. 6 Permutations Very little of this section comes from PJE Definition A permutation (p147 of a set A is a bijection ρ : A A Notation If A = {a b c } and ρ is a permutation on A we can express the action

More information

NOTES ON SIMPLE NUMBER THEORY

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,

More information

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

More information

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

More information

LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS

LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS Modular arithmetics that we have discussed in the previous lectures is very useful in Cryptography and Computer Science. Here we discuss several

More information

2 More on Congruences

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

More information

= 1 2x. x 2 a ) 0 (mod p n ), (x 2 + 2a + a2. x a ) 2

= 1 2x. x 2 a ) 0 (mod p n ), (x 2 + 2a + a2. x a ) 2 8. p-adic numbers 8.1. Motivation: Solving x 2 a (mod p n ). Take an odd prime p, and ( an) integer a coprime to p. Then, as we know, x 2 a (mod p) has a solution x Z iff = 1. In this case we can suppose

More information

ECE596C: Handout #11

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

More information

M381 Number Theory 2004 Page 1

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 +

More information

Math 109 HW 9 Solutions

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

More information

Chapter 1 : The language of mathematics.

Chapter 1 : The language of mathematics. MAT 200, Logic, Language and Proof, Fall 2015 Summary Chapter 1 : The language of mathematics. Definition. A proposition is a sentence which is either true or false. Truth table for the connective or :

More information

Wilson s Theorem and Fermat s Little Theorem

Wilson s Theorem and Fermat s Little Theorem Wilson s Theorem and Fermat s Little Theorem Wilson stheorem THEOREM 1 (Wilson s Theorem): (p 1)! 1 (mod p) if and only if p is prime. EXAMPLE: We have (2 1)!+1 = 2 (3 1)!+1 = 3 (4 1)!+1 = 7 (5 1)!+1 =

More information

LECTURE 4: CHINESE REMAINDER THEOREM AND MULTIPLICATIVE FUNCTIONS

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

More information

1. multiplication is commutative and associative;

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.

More information

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Winter CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Today's learning goals Determine whether a relation is an equivalence relation by determining whether it is Reflexive Symmetric

More information

AN ALGEBRAIC PROOF OF RSA ENCRYPTION AND DECRYPTION

AN ALGEBRAIC PROOF OF RSA ENCRYPTION AND DECRYPTION AN ALGEBRAIC PROOF OF RSA ENCRYPTION AND DECRYPTION Recall that RSA works as follows. A wants B to communicate with A, but without E understanding the transmitted message. To do so: A broadcasts RSA method,

More information

Math 312/ AMS 351 (Fall 17) Sample Questions for Final

Math 312/ AMS 351 (Fall 17) Sample Questions for Final Math 312/ AMS 351 (Fall 17) Sample Questions for Final 1. Solve the system of equations 2x 1 mod 3 x 2 mod 7 x 7 mod 8 First note that the inverse of 2 is 2 mod 3. Thus, the first equation becomes (multiply

More information

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

More information

Introduction to Public-Key Cryptosystems:

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

More information

Sums of Squares. Bianca Homberg and Minna Liu

Sums of Squares. Bianca Homberg and Minna Liu Sums of Squares Bianca Homberg and Minna Liu June 24, 2010 Abstract For our exploration topic, we researched the sums of squares. Certain properties of numbers that can be written as the sum of two squares

More information

Primes and Factorization

Primes and Factorization Primes and Factorization 1 A prime number is an integer greater than 1 with no proper divisors. The list begins 2, 3, 5, 7, 11, 13, 19,... See http://primes.utm.edu/ for a wealth of information about primes.

More information

MATH 361: NUMBER THEORY FOURTH LECTURE

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

More information

Contest Number Theory

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,

More information

Fermat's Little Theorem

Fermat's Little Theorem Fermat's Little Theorem CS 2800: Discrete Structures, Spring 2015 Sid Chaudhuri Not to be confused with... Fermat's Last Theorem: x n + y n = z n has no integer solution for n > 2 Recap: Modular Arithmetic

More information

Integers and Division

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

More information

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

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

More information

Ma/CS 6a Class 2: Congruences

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

More information

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

More information

Part V. Chapter 19. Congruence of integers

Part V. Chapter 19. Congruence of integers Part V. Chapter 19. Congruence of integers Congruence modulo m Let m be a positive integer. Definition. Integers a and b are congruent modulo m if and only if a b is divisible by m. For example, 1. 277

More information

Number Theory and Group Theoryfor Public-Key Cryptography

Number Theory and Group Theoryfor Public-Key Cryptography Number Theory and Group Theory for Public-Key Cryptography TDA352, DIT250 Wissam Aoudi Chalmers University of Technology November 21, 2017 Wissam Aoudi Number Theory and Group Theoryfor Public-Key Cryptography

More information

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography David R. Wilkins Copyright c David R. Wilkins 2006 Contents 9 Introduction to Number Theory and Cryptography 1 9.1 Subgroups

More information

MATH 145 Algebra, Solutions to Assignment 4

MATH 145 Algebra, Solutions to Assignment 4 MATH 145 Algebra, Solutions to Assignment 4 1: a) Find the inverse of 178 in Z 365. Solution: We find s and t so that 178s + 365t = 1, and then 178 1 = s. The Euclidean Algorithm gives 365 = 178 + 9 178

More information

Ma/CS 6a Class 2: Congruences

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

More information

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

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

More information

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

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

More information

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Winter CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Today's learning goals Define and use the congruence modulo m equivalence relation Perform computations using modular arithmetic

More information

FERMAT S TEST KEITH CONRAD

FERMAT S TEST KEITH CONRAD FERMAT S TEST KEITH CONRAD 1. Introduction Fermat s little theorem says for prime p that a p 1 1 mod p for all a 0 mod p. A naive extension of this to a composite modulus n 2 would be: for all a 0 mod

More information

Part II. Number Theory. Year

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

More information

Chapter 3 Basic Number Theory

Chapter 3 Basic Number Theory Chapter 3 Basic Number Theory What is Number Theory? Well... What is Number Theory? Well... Number Theory The study of the natural numbers (Z + ), especially the relationship between different sorts of

More information

MATH 310: Homework 7

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

More information

CPSC 467: Cryptography and Computer Security

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

More information

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

Definitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations Page 1 Definitions Tuesday, May 8, 2018 12:23 AM Notations " " means "equals, by definition" the set of all real numbers the set of integers Denote a function from a set to a set by Denote the image of

More information

Quadratic Congruences, the Quadratic Formula, and Euler s Criterion

Quadratic Congruences, the Quadratic Formula, and Euler s Criterion Quadratic Congruences, the Quadratic Formula, and Euler s Criterion R. C. Trinity University Number Theory Introduction Let R be a (commutative) ring in which 2 = 1 R + 1 R R. Consider a quadratic equation

More information

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

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

More information

Number theory (Chapter 4)

Number theory (Chapter 4) EECS 203 Spring 2016 Lecture 10 Page 1 of 8 Number theory (Chapter 4) Review Questions: 1. Does 5 1? Does 1 5? 2. Does (129+63) mod 10 = (129 mod 10)+(63 mod 10)? 3. Does (129+63) mod 10 = ((129 mod 10)+(63

More information

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?

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

More information

Topics in Cryptography. Lecture 5: Basic Number Theory

Topics in Cryptography. Lecture 5: Basic Number Theory Topics in Cryptography Lecture 5: Basic Number Theory Benny Pinkas page 1 1 Classical symmetric ciphers Alice and Bob share a private key k. System is secure as long as k is secret. Major problem: generating

More information

. As the binomial coefficients are integers we have that. 2 n(n 1).

. As the binomial coefficients are integers we have that. 2 n(n 1). Math 580 Homework. 1. Divisibility. Definition 1. Let a, b be integers with a 0. Then b divides b iff there is an integer k such that b = ka. In the case we write a b. In this case we also say a is a factor

More information

Introduction to Number Theory 1. c Eli Biham - December 13, Introduction to Number Theory 1

Introduction to Number Theory 1. c Eli Biham - December 13, Introduction to Number Theory 1 Introduction to Number Theory 1 c Eli Biham - December 13, 2012 206 Introduction to Number Theory 1 Division Definition: Let a and b be integers. We say that a divides b, or a b if d s.t. b = ad. If b

More information

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

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time. 8 Modular Arithmetic We introduce an operator mod. Let d be a positive integer. For c a nonnegative integer, the value c mod d is the remainder when c is divided by d. For example, c mod d = 0 if and only

More information

Homework 3, solutions

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

More information

EULER S THEOREM KEITH CONRAD

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

More information

Introduction Integers. Discrete Mathematics Andrei Bulatov

Introduction Integers. Discrete Mathematics Andrei Bulatov Introduction Integers Discrete Mathematics Andrei Bulatov Discrete Mathematics - Integers 9- Integers God made the integers; all else is the work of man Leopold Kroenecker Discrete Mathematics - Integers

More information