NUMBER THEORY Amin Witno

Similar documents
NUMBER THEORY AMIN WITNO

MATH 118 PROBLEM SET 6

LECTURE 9: QUADRATIC RESIDUES AND THE LAW OF QUADRATIC RECIPROCITY

Primitive Roots. Chapter Orders and Primitive Roots

Example. Check that the Jacobian of the transformation to spherical coordinates is

Spiral Tilings with C-curves

Math Circles Finite Automata Question Sheet 3 (Solutions)

Theme: Don t get mad. Learn mod.

First Round Solutions Grades 4, 5, and 6

CS 135: Computer Architecture I. Boolean Algebra. Basic Logic Gates

Domination and Independence on Square Chessboard

Lecture 20. Intro to line integrals. Dan Nichols MATH 233, Spring 2018 University of Massachusetts.

Introduction to Modular Arithmetic

Section 16.3 Double Integrals over General Regions

SOLUTIONS TO PROBLEM SET 5. Section 9.1

CHAPTER 2. Modular Arithmetic

Polar Coordinates. July 30, 2014

Number Theory. Konkreetne Matemaatika

Energy Harvesting Two-Way Channels With Decoding and Processing Costs

Unit 1: Chapter 4 Roots & Powers

PT. Primarity Tests Given an natural number n, we want to determine if n is a prime number.

Foundations of Cryptography

9.4. ; 65. A family of curves has polar equations. ; 66. The astronomer Giovanni Cassini ( ) studied the family of curves with polar equations

Wilson s Theorem and Fermat s Theorem

MAXIMUM FLOWS IN FUZZY NETWORKS WITH FUNNEL-SHAPED NODES

Solutions for the Practice Final

10.4 AREAS AND LENGTHS IN POLAR COORDINATES

Section 17.2: Line Integrals. 1 Objectives. 2 Assignments. 3 Maple Commands. 1. Compute line integrals in IR 2 and IR Read Section 17.

Kirchhoff s Rules. Kirchhoff s Laws. Kirchhoff s Rules. Kirchhoff s Laws. Practice. Understanding SPH4UW. Kirchhoff s Voltage Rule (KVR):

Discrete Math Class 4 ( )

Fermat s little theorem. RSA.

Assignment 2. Due: Monday Oct. 15, :59pm

To be able to determine the quadratic character of an arbitrary number mod p (p an odd prime), we. The first (and most delicate) case concerns 2

Congruences for Stirling Numbers of the Second Kind Modulo 5

6. Find an inverse of a modulo m for each of these pairs of relatively prime integers using the method

METHOD OF LOCATION USING SIGNALS OF UNKNOWN ORIGIN. Inventor: Brian L. Baskin

SOLVING TRIANGLES USING THE SINE AND COSINE RULES

Number Theory - Divisibility Number Theory - Congruences. Number Theory. June 23, Number Theory

L29&30 - RSA Cryptography

(CATALYST GROUP) B"sic Electric"l Engineering

Solutions to exercise 1 in ETS052 Computer Communication

General Augmented Rook Boards & Product Formulas

p 1 MAX(a,b) + MIN(a,b) = a+b n m means that m is a an integer multiple of n. Greatest Common Divisor: We say that n divides m.

CHAPTER 2 LITERATURE STUDY

Mathematics Explorers Club Fall 2012 Number Theory and Cryptography

ECE 274 Digital Logic. Digital Design. Datapath Components Shifters, Comparators, Counters, Multipliers Digital Design

UNIVERSITY OF MANITOBA DATE: December 7, FINAL EXAMINATION TITLE PAGE TIME: 3 hours EXAMINER: M. Davidson

The Chinese Remainder Theorem

Synchronous Machine Parameter Measurement

Student Book SERIES. Fractions. Name

Module 9. DC Machines. Version 2 EE IIT, Kharagpur

ON THE EQUATION a x x (mod b) Jam Germain

Collection of rules, techniques and theorems for solving polynomial congruences 11 April 2012 at 22:02

Discrete Mathematics & Mathematical Reasoning Multiplicative Inverses and Some Cryptography

Lecture 16. Double integrals. Dan Nichols MATH 233, Spring 2018 University of Massachusetts.

Public Key Encryption

Joanna Towler, Roading Engineer, Professional Services, NZTA National Office Dave Bates, Operations Manager, NZTA National Office

Student Book SERIES. Patterns and Algebra. Name

Number Theory/Cryptography (part 1 of CSC 282)

Vector Calculus. 1 Line Integrals

Synchronous Generator Line Synchronization

Make Your Math Super Powered

University of North Carolina-Charlotte Department of Electrical and Computer Engineering ECGR 4143/5195 Electrical Machinery Fall 2009

Exercise 1-1. The Sine Wave EXERCISE OBJECTIVE DISCUSSION OUTLINE. Relationship between a rotating phasor and a sine wave DISCUSSION

Math 116 Calculus II

Math 127: Equivalence Relations

Solutions for the Practice Questions

MAT Modular arithmetic and number theory. Modular arithmetic

The Discussion of this exercise covers the following points:

Application Note. Differential Amplifier

Math 319 Problem Set #7 Solution 18 April 2002

Defining the Rational Numbers

Geometric quantities for polar curves

Samantha s Strategies page 1 of 2

Example: Modulo 11: Since Z p is cyclic, there is a generator. Let g be a generator of Z p.

Solutions to Exam 1. Problem 1. a) State Fermat s Little Theorem and Euler s Theorem. b) Let m, n be relatively prime positive integers.

Algebra Practice. Dr. Barbara Sandall, Ed.D., and Travis Olson, M.S.

Exam 1 7 = = 49 2 ( ) = = 7 ( ) =

The Math Learning Center PO Box 12929, Salem, Oregon Math Learning Center

University of British Columbia. Math 312, Midterm, 6th of June 2017

Understanding Basic Analog Ideal Op Amps

b) Find all positive integers smaller than 200 which leave remainder 1, 3, 4 upon division by 3, 5, 7 respectively.

Practice Midterm 2 Solutions

The Chinese Remainder Theorem

Polar coordinates 5C. 1 a. a 4. π = 0 (0) is a circle centre, 0. and radius. The area of the semicircle is π =. π a

Algorithmic Number Theory and Cryptography (CS 303)

Algorithms for Memory Hierarchies Lecture 14

Interference Cancellation Method without Feedback Amount for Three Users Interference Channel

Synchronous Machine Parameter Measurement

& Y Connected resistors, Light emitting diode.

An interesting class of problems of a computational nature ask for the standard residue of a power of a number, e.g.,

EE Controls Lab #2: Implementing State-Transition Logic on a PLC

LECTURE 3: CONGRUENCES. 1. Basic properties of congruences We begin by introducing some definitions and elementary properties.

1 tray of toffee 1 bar of toffee. 10 In the decimal number, 0 7, the 7 refers to 7 tenths or

Number Theory and Security in the Digital Age

Data security (Cryptography) exercise book

EE 418: Network Security and Cryptography

ABB STOTZ-KONTAKT. ABB i-bus EIB Current Module SM/S Intelligent Installation Systems. User Manual SM/S In = 16 A AC Un = 230 V AC

CMPSCI 250: Introduction to Computation. Lecture #14: The Chinese Remainder Theorem David Mix Barrington 4 October 2013

Final exam. Question Points Score. Total: 150

Transcription:

WON Series in Discrete Mthemtics nd Modern Algebr Volume 2 NUMBER THEORY Amin Witno Prefce Written t Phildelphi University, Jordn for Mth 313, these notes 1 were used first time in the Fll 2005 semester. They hve since been revised 2 nd shll be revised gin s often s the uthor teches the course. Outline notes re more like revision. No student is expected to fully benefit from these notes unless they hve regulrly ttended the lectures. 1 Divisibility The nturl numbers 1, 2, 3,... together with their negtives nd zero mke up the set of integers. Number Theory is the study of integers. Every number represented throughout these notes will be understood n integer unless otherwise stted. Definition. The number d divides m, or m is divisible by d, if the opertion m d yields n integer. This reltion my be written d m, or d m if it is not true. When d m, the number d is lso clled divisor of m, nd m multiple of d. For exmple 3 18 nd 5 18. We my lso stte tht even numbers re multiples of 2. 1.1 Proposition (Properties of divisibility) 1. The number 1 divides ll integers. 2. d 0 nd d d for ny integer d 0. 3. If d m nd m n then d n. 4. If d m nd d n then d (m + bn) for ny integers nd b. Proof. The first two sttements follow immeditely from the definition of divisibility. For (3) simply observe tht if m/d nd n/m re integers then so is n/d = n/m m/d. Similrly for (4), the number (m + bn)/d = (m/d) + b(n/d) is n integer when d m nd d n. Definition. For every rel number x, the nottion x denotes the gretest integer x. For exmple 3.14 = 3 nd 2 = 2. Now with n > 0, define the residue of m mod n by m % n = m m/n n. Here the symbol (%) is red mod. For exmple 18 % 5 = 3 1 Copyrighted under Cretive Commons License c 2005 2007 Amin Witno 2 Lst Revision: 24 12 2006 www. w i t n o. com

WON 2 Number Theory 2 nd 18 % 3 = 0. Note tht m % n is relly the reminder upon dividing m by n nd it lies in the rnge 0 m % n n 1. In prticulr m % n = 0 if nd only if n m. Exercise. Find these residues. 1. 369 % 5 2. 24 % 8 3. 123456789 % 10 4. 7 % 11 1.2 Proposition One in every n consecutive integers is divisible by n. Proof. Let m be the first integer nd let k = m % n. If k = 0 then n m. Otherwise 1 k n 1 nd our consecutive integers cn be written m = m/n n + k, m/n n + (k + 1), m/n n + (k + 2),..., m/n n + (k + n 1) with k + n 1 n. Then one of these numbers is m/n n + n, multiple of n. Definition. The gretest common divisor of two integers m nd n is the lrgest integer which divides both. This number is denoted by gcd(m, n). For exmple gcd(18, 24) = 6 becuse 6 is the lrgest integer with the property 6 18 nd 6 24. Exercise. Find gcd(36, 48), gcd(24, 0), gcd(1, 99), gcd(100, 123). 1.3 The Eucliden Algorithm gcd(m, n) = gcd(n, m % n) Proof. It suffices to show tht the two pirs {m, n} nd {n, m % n} hve identicl sets of common divisors. This is chieved entirely using Proposition 1.1.4 upon observing tht, from its definition, m % n is liner combintion of m nd n, nd so is m of n nd m % n. Exercise. Use Eucliden Algorithm to compute gcd(m, n). 1. m = 144, n = 456 2. m = 503, n = 999 3. m = 725, n = 1000 4. m = 12345, n = 67890 1.4 Theorem gcd(m, n) = m + bn for some integers nd b. Proof. Note tht pplying the Eucliden Algorithm successively will lwys terminte with zero s the lst residue: gcd(m, n) = gcd(n, m % n) = gcd(m % n, n % (m % n)) = = gcd(d, 0) in which cse gcd(m, n) = d. Since ech integer in the pir is liner combintion of the previous pir of integers, we my by finite number of steps express d s liner combintion of m nd n. Remrk. The lgorithm involved in ctully finding the integers nd b is clled the Extended Eucliden Algorithm, the detils of which will be discussed in Project 1 given t the end of this chpter. 1.5 Corollry Let L be the set of ll integrl liner combintions of m nd n. Then

WON 2 Number Theory 3 1. L is equl to the set of ll multiples of gcd(m, n). 2. gcd(m, n) is the lest positive element of L. 3. gcd(m, n) = 1 if nd only if 1 L. 4. gcd(m, n) = 1 if nd only if L is the set of ll integers. Proof. All multiples of gcd(m, n) belong to L by Theorem 1.4. Conversely gcd(m, n) divides every element of L ccording to Proposition 1.1.4. This proves the first sttement, from which follow the remining three. 1.6 Proposition (Properties of gretest common divisors) 1. If d m nd d n then d gcd(m, n). 2. If d gcd(m, n) then gcd(m/d, n/d) = gcd(m, n)/d. 3. If d mn nd gcd(d, m) = 1 then d n. Euclid s Lemm 4. If c m nd d m with gcd(c, d) = 1 then cd m. 5. If gcd(m, n) = 1 nd gcd(m, n) = 1 then gcd(mm, n) = 1. Proof. (1) This is corollry of Theorem 1.4 nd Proposition 1.1.4. (2) By Corollry 1.5.2, gcd(m/d, n/d) is the lest positive liner combintion of m/d nd n/d, which is 1/d times the lest positive liner combintion of m nd n, tht is gcd(m, n)/d. (3) By Theorem 1.4 if gcd(d, m) = 1 then 1 = d + bm for some integers nd b. Multiplying this lst eqution by n/d yields n/d = n + b(mn/d), which is n integer if d mn. (4) Agin gcd(c, d) = 1 implies 1 = c + bd. This time multiply through by m/(cd) to get m/(cd) = (m/d) + b(m/c), which is n integer if c m nd d m. (5) Write 1 = m + bn nd 1 = m + b n nd multiply the two equtions together: 1 = mm + (b m + bm + bb n)n This displys 1 s liner combintion of mm nd n nd hence gcd(mm, n) = 1 by Corollry 1.5.3. 1.7 Liner Eqution Theorem The liner eqution mx+ny = c hs solution if nd only if d = gcd(m, n) c, in which cse ll its solutions re given by ( x 0 k n, y ) d 0 + k m d for ny prticulr solution (x 0, y 0 ) nd for ny integer k. Proof. The first prt of the theorem is resttement of Corollry 1.5.1. Now suppose we hve prticulr solution (x 0, y 0 ) nd consider first the cse d = 1. All solutions of the liner eqution must lie on the line pssing through (x 0, y 0 ) with slope equl m/n. Another point on this line will be given by (x 0 t, y 0 + tm/n) for ny rel number t. If the coordintes re to be integers then by Euclid s Lemm we must hve t = kn for some integer k. Thus the generl solution (x 0 kn, y 0 + km). For the cse d > 1 we replce our eqution by (m/d)x + (n/d)y = c/d without ltering its solution set. But then Proposition 1.6.2 implies tht gcd(m/d, n/d) = 1 nd therefore the generl solution is (x 0 kn/d, y 0 + km/d). Exercise. Find ll the solutions, if ny, of these equtions. 1. 5x + 8y = 1 2. 12x + 25y = 3

WON 2 Number Theory 4 3. 24x + 18y = 6 4. 25x + 65y = 40 1.8 Corollry gcd(m, n) = 1 if nd only if the eqution mx + ny = 1 hs solution. Proof. This follows since gcd(m, n) 1 if nd only if gcd(m, n) = 1. Problem Set 1 1. Does 3 divide 250313? Wht is 250313 % 3? 2. The time is now 11 o clock in the morning. Wht time will it be fter 100 hours? 3. Find ll integers n in the rnge 1 n 12 such tht gcd(n, 12) = 1. 4. Compute gcd(12345, 54321). 5. Find solution of 34x + 55y = 1. 6. Find ll the solutions of 25x + 65y = 270. 7. I mde two clls tody vi MobileCom, one cll to nother MobileCom line for 6 pisters per minute nd nother cll to FstLink number for 16 pisters per minute. The totl chrge ws 90 pisters. For how long did I tlk in ech cll? 8. Investigte true or flse. () If d m then d m. (b) If m n nd n m then m = n. (c) If c m nd d n then cd mn. (d) If d mn then either d m or d n. (e) If dn mn then d m. 9. Investigte true or flse. () gcd(m, n) > 0 (b) gcd(m, n) = gcd(m n, n) (c) gcd(m, mn) = m (d) gcd(m, m + 1) = 1 (e) gcd(m, m + 2) = 2 10. Prove tht if k > 0 then gcd(km, kn) = k gcd(m, n). 11. Prove tht n 2 + n is even. 12. Prove tht n 2 + 2 is not divisible by 4. 13. Prove tht n 2 1 is multiple of 8 when n is odd. 14. Prove 6 (n 3 n). 15. Prove 24 (n 3 n) if n is odd. 16. Prove 30 (n 5 n). Project 1 Extended Eucliden Algorithm The gol is to express the gretest common divisor of two integers s their liner combintion, tht is to write gcd(m, n) = m + bn for some integers nd b. We hve seen how the Eucliden Algorithm is used to evlute gcd(m, n). For exmple we find tht gcd(216, 78) = 6 s the lst non-zero reminder in the following recursive steps. 216 = 2(78) + 60 78 = 1(60) + 18 60 = 3(18) + 6 18 = 3(6) + 0

WON 2 Number Theory 5 Now rewrite these equtions in order to express ech reminder s liner combintion of m = 216 nd n = 78. 60 = 1(216) 2(78) 18 = 1(78) 1(60) = 1(78) 1{1(216) 2(78)} = 1(216) + 3(78) 6 = 1(60) 3(18) = 1{1(216) 2(78)} 3{ 1(216) + 3(78)} = 4(216) 11(78) We shll next simplify the ppernce of the bove lgorithm by not writing the m nd n in ech row. For convenience we dd two extr rows t the top, corresponding to the equtions 216 = 1(216) + 0(78) nd 78 = 0(216) + 1(78), in this order. 216 1 0 78 0 1 60 1 2 18 1 3 6 4 11 Recll tht the lst row gives the desired result gcd(216, 78) = 6 = 4(216) 11(78). If we lbel the first column, from the top down r 1, r 2, r 3,... then these numbers stisfy the recurrence reltion given by r n = r n /r n+1 r n+1 + r n+2, which mens tht row (n + 2) is obtined by subtrcting r n /r n+1 times row (n + 1) from row n. Exercise. Continue with Exercise 1.3 to find nd b such tht gcd(m, n) = m + bn. Assignment. Repet this exercise with m = 180180 nd n equls the number obtined from the lst six digits of your Phildelphi University Number. This is your personl 6-digit PUN, to be remembered nd used gin in subsequent projects. 2 Prime Numbers Definition. A prime number is n integer p > 1 with no positive divisors except 1 nd p itself. An integer n > 1 which is not prime number is clled composite. For exmple 13 nd 17 re primes, but 21 is composite becuse 21 = 3 7. Throughout these notes we shll designte p to lwys denote prime number. Exercise. Find ll prime numbers up to 100. 2.1 Proposition (Properties of primes) 1. Every integer greter thn 1 hs prime divisor. 2. n is composite if nd only if it hs prime divisor n. 3. gcd(p, n) = p if p n, otherwise gcd(p, n) = 1. 4. If p mn then either p m or p n. 5. If p n 1 n 2 n k then p divides one of n 1, n 2,..., n k.

WON 2 Number Theory 6 Proof. (1) Suppose, by induction, the sttement is true up to n 1. Either n is prime, nd its own prime divisor, or else it hs divisor d stisfying 1 < d < n. It follows tht d hs prime divisor which is lso divisor of n by Proposition 1.1.3. (2) For prime p there is clerly no prime divisor p. For composite n = b with, b > 1 either n or b n must hold. Whichever is true, by (1) or b hs prime divisor d, which stisfies d n nd d n. (3) The sttement is obvious since 1 nd p re the only divisors of p. (4) If p m then by (3) gcd(p, m) = 1 nd by Euclid s Lemm p n. (5) Repeted use of (4) estblishes this clim. 2.2 Theorem There re infinitely mny prime numbers. Proof. If there were only finitely mny prime numbers, let N be the product of them ll. Now by Proposition 2.1.1, one of these prime divisors of N must lso divide N + 1, thus it would lso divide 1 = (N + 1) N ccording to Proposition 1.1.4. This is bsurd becuse ll primes re lrger thn 1. 2.3 The Fundmentl Theorem of Arithmetic Every integer greter thn 1 is product of prime numbers in unique wy up to reordering. Proof. We use induction to show tht such integer is product of primes. Suppose this clim is true up to n 1. By Proposition 2.1.1, n hs prime divisor, sy n = pn with n < n. It follows tht n is product of primes nd so is n. To prove uniqueness we proceed by contrdiction. Suppose we hve two different multisets of primes p s nd q s whose products both equl n. Equting these products nd cncelling out ll common terms will result in p 1 p 2 p j = q 1 q 2 q k where none of the p s equls ny of the q s. By Proposition 2.1.5, p 1 must divide one of the q s, sy q i, implying tht p 1 = q i, contrdiction. Exercise. Fctor the numbers 123, 400, 720, 7575 into primes. 2.4 Corollry Let m nd n be fctored into powers of distinct primes: m = p j i i n = p k i i, with j i, k i 0. Then gcd(m, n) = p e i i where e i = min{j i, k i }. Proof. By Theorem 2.3 divisor of m must be of the form d = p e i i with e i j i. Similrly if d n then e i k i nd so the gretest such d is the cse e i = min{j i, k i }. Exercise. Find gcd(m, n). 1. m = 2 2 3 5 3 7 3, n = 2 5 3 2 5 7 2 2. m = 2 3 3 8 5 4 7 5, n = 3 7 5 2 7 2 3. m = 2 5 5 7 11 3, n = 3 7 7 2 13 9 4. m = 2 4 5 2 7 11 3, n = 2 7 3 2 5 2 11 2.5 Conjectures (Unsolved problems concerning prime numbers) 1. There re infinitely mny primes in the sequence {n 2 + 1}. 2. Twin Primes. There re infinitely mny primes in the sequence {p + 2}. 3. Mersenne Primes. There re infinitely mny primes in the sequence {2 p 1}. 4. Fermt Primes. There re only finitely mny primes in the sequence {2 2n + 1}. 5. Goldbch s Conjecture. Every even number n > 2 is sum of two primes. nd

WON 2 Number Theory 7 2.6 Dirichlet s Theorem on Primes in Arithmetic Progressions There re infinitely mny primes in the sequence {n + b} if nd only if gcd(, b) = 1. Proof for = 4 nd b = 3. First note tht prime p > 2 must hve the form 4n + 1 or 4n + 3. Second, the product of two numbers in the form 4n + 1 is gin of the sme form, hence number in the form 4n + 3 must hve prime divisor of the form 4n + 3. We clim tht there re infinitely mny primes in the sequence {4n + 3}. If it were not so, let N be the product of them ll. As noted, one of these prime divisors of N must be prime divisor of the number 4(N 1) + 3 hence it would lso divide 1 = 4N (4(N 1) + 3) nd this is contrdiction. 2.7 The Prime Number Theorem Let π(x) denote the number of primes up to x. For exmple π(13) = {2, 3, 5, 7, 11, 13} = 6 nd π(100) = 25. Then lim x π(x) x/ log x = 1 nd even more ccurtely, π(x) cn be estimted by x/(log x 1) for lrge vlues of x. No Proof. The proof is beyond the scope of elementry number theory. Exercise. Approximtely how mny prime numbers re there up to 10,000,000? Problem Set 2 1. Fctor the number 250313 into primes. 2. Find ll the positive divisors of 300 = 2 2 3 5 2. 3. How mny positive integers divide the number n = 2 4 3 2 5 7 3? 4. Find ll pirs of twin primes up to 100. 5. Find ll primes in the form n 2 + 1 up to 100. 6. Write the number 2006 s sum of two primes in five different wys. 7. Find five Mersenne primes. 8. Find five Fermt primes. 9. Estimte the number of primes up to one million. 10. Estimte the number of primes mong the ten-digit integers. 11. Investigte true or flse. () n 2 + n + 41 is prime for ll n 0. (b) n 2 81n + 1681 is prime for ll n 1. (c) If p n 2 then p 2 n 2. (d) If p n 2 then p n. (e) If p n k then p n. 12. The lest common multiple of two integers is the smllest positive integer which is divisible by both. For exmple lcm(4, 6) = 12 becuse 12 is the smllest positive integer with the property 4 12 nd 6 12. () Use prime fctoriztion to find formul for lcm(m, n). (b) Find reltion between gcd(m, n) nd lcm(m, n). (c) Illustrte your nswers using m = 600 nd n = 630. 13. Prove tht if d 2 m 2 then d m. 14. Prove gcd(m 2, n 2 ) = gcd(m, n) 2. 15. Find ll prime triplets, nmely p, p + 2, p + 4, ll of which re primes. 16. Prove tht there re infinitely mny primes in the sequence {6n + 5}.

WON 2 Number Theory 8 Project 2 Fermt Fctoriztion If n = x 2 y 2 then it fctors to n = (x + y)(x y). This fct is the simple ide behind the method of Fermt Fctoriztion. We seek fctor of n by clculting the numbers y 2 = x 2 n for ech integer x n until we find perfect squre. For exmple with n = 4277 we first clculte 4277 65.39 so we strt with x = 66. 66 2 4277 = 79 67 2 4277 = 212 68 2 4277 = 347 69 2 4277 = 484 = 22 2 The result is 4277 = 69 2 22 2 = (69 + 22)(69 22) = 91 47. Fermt Fctoriztion lwys works when n is odd becuse if n = b with both, b odd then n = x 2 y 2 with x = ( + b)/2 nd y = ( b)/2. Moreover this shows tht we should terminte the process when x = (n + 1)/2, in which cse n = n 1 is prime. Exercise. Follow the bove exmple with the numbers 2117, 16781, 65593, nd 70027. Assignment. With the help of Fermt Fctoriztion try to fctor into primes your personl 6-digit PUN from Project 1. 3 Congruences Definition. Two integers nd b re congruent modulo n > 0 if n ( b), in which cse we write b (mod n). Equivlently we my define b (mod n) to men % n = b % n nd in prticulr % n (mod n). For exmple 13 4 (mod 3) nd for rbitrry even numbers nd b we hve b 0 (mod 2). 3.1 Proposition (Properties of congruences) 1. If b (mod n) nd c d (mod n) then + c b + d (mod n). 2. If b (mod n) nd c d (mod n) then c bd (mod n). 3. If b (mod n) then f() f(b) (mod n) for ny integrl polynomil f(x). 4. If b (mod m) nd b (mod n) with gcd(m, n) = 1 then b (mod mn). 5. If m mb (mod n) nd gcd(m, n) = 1 then b (mod n). Proof. First note tht b (mod n) holds if nd only if = b + jn for some integer j. Now if both = b + jn nd c = d + kn then the sum + c = b + d + (j + k)n nd the product c = bd + (bk + jd + jkn)n show why (1) nd (2) re true. For the remining clims, (3) is nturl generliztion of (1) nd (2), wheres (4) follows directly from Proposition 1.6.4, nd (5) from Euclid s Lemm. Definition. Congruence modulo n is n equivlence reltion over the integers with n congruence clsses, nmely the clsses of integers whose residues mod n re 0, 1, 2,..., up to n 1. A set of n numbers form complete residue system modulo n if ech comes from different congruence clss. For exmple complete residue system modulo 7 cn be {0, 1, 2, 3, 4, 5, 6}, {1, 2, 3, 4, 5, 6, 7}, or {0, 1, 2, 10, 11, 75, 1}, etc. Exercise. Find complete residue system modulo 7 with only even numbers.

WON 2 Number Theory 9 3.2 Liner Congruence Theorem The congruence mx c (mod n) hs solution if nd only if d = gcd(m, n) c, in which cse it hs exctly d solutions modulo n given by x x 0 + kn/d (mod n) for k = 0, 1, 2,..., d 1 nd for ny prticulr solution x 0. Proof. The congruence is equivlent to the liner eqution mx = c + ny nd the theorem is relly corollry of the Liner Eqution Theorem. Exercise. Count how mny solutions ech congruence hs, then find them. 1. 8x 5 (mod 13) 2. 35x 7 (mod 49) 3. 27x 1 (mod 209) 4. 6x 9 (mod 1023) Definition. Two integers nd b re inverses of ech other modulo n if b 1 (mod n). For exmple 3 nd 5 re inverses modulo 7 since 3 5 = 15 1 (mod 7). Similrly the congruence 5 2 1 (mod 12) implies tht 5 is its own inverse modulo 12. 3.3 Modulr Inverse Theorem The number hs n inverse modulo n if nd only if gcd(, n) = 1, in which cse its inverse, written b = 1, is unique modulo n. Proof. Simply let m = nd c = 1 in the Liner Congruence Theorem. Exercise. Find 1 modulo n if it exists. 1. = 2, n = 7 2. = 5, n = 8 3. = 35, n = 42 4. = 27, n = 209 3.4 Chinese Reminder Theorem If gcd(m, n) = 1 then the pir of congruences x c (mod m) nd x d (mod n) hve unique common solution modulo mn. Proof. All solutions of x c (mod m) re of the form c + mk, which is common solution if nd only if c + mk d (mod n), or mk d c (mod n). By the Liner Congruence Theorem there exists such n integer k since gcd(m, n) = 1 (d c). Now ny two solutions must stisfy x 1 c x 2 (mod m) nd x 1 d x 2 (mod n) so tht x 1 x 2 (mod mn) by Proposition 3.1.4, proving uniqueness. Exercise. Find common solution of x 5 (mod 8) nd x 7 (mod 11). Definition. The numbers m nd n re reltively prime if gcd(m, n) = 1. Three or more integers re pirwise reltively prime if they re reltively prime one to nother. An exmple is 8, 11, nd 15, where gcd(8, 11) = gcd(8, 15) = gcd(11, 15) = 1. 3.5 Chinese Reminder Theorem (Generl) Suppose n 1, n 2,..., n k re pirwise reltively prime. Then the system of congruences x c i (mod n i ) for i = 1, 2,..., k hs unique solution modulo N = n 1 n 2 n k. Explicitly the solution is given by x k i=1 where ech inverse is tken modulo n i. c i ( N n i ) ( N n i ) 1 (mod N)

WON 2 Number Theory 10 ( ) ( ) 1 Proof. To check tht the solution stisfies the system is trivil for c N N i n i n i c i (mod n i ) for ech i. To see tht this solution is unique is gin by the use of Proposition 3.1.4, together with Proposition 1.6.5. Exercise. Find the smllest integer x > 0 stisfying the system of congruences. 1. x 5 (mod 8), x 7 (mod 11) 2. x 3 (mod 4), x 2 (mod 5), x 5 (mod 7) 3. x 1 (mod 9), x 2 (mod 10), x 3 (mod 11) 4. x 1 (mod 2), x 2 (mod 3), x 1 (mod 5), x 2 (mod 7) 3.6 Lemm If 2 1 (mod p) then ±1 (mod p). Proof. According to Proposition 2.1.4, if p divides 2 1 = (+1)( 1) then p (+1) or p ( 1), which is equivlent to the sttement of the lemm. 3.7 Wilson s Theorem If p is prime then (p 1)! 1 (mod p). Proof. The Modulr Inverse Theorem ssures tht ech of the numbers 1, 2,..., p 1 hs n inverse modulo p, nd by Lemm 3.6 none of them is self-inverse, except 1 nd p 1. Hence (p 1)! consists of the product of pirs of inverses modulo p, except 1 nd p 1, which do not get pired up. This gives the desired congruence. Exercise. Compute k! % 13 for k = 11, 12, 13, 14. Problem Set 3 1. Find complete residue system modulo 9 with only odd numbers. 2. Find complete residue system modulo 5 with only prime numbers. 3. Find ll the solutions of 12x 18 (mod 54). 4. Find the inverse of 7 modulo 12. 5. Which integers in the rnge 1 12 hve n inverse modulo 12? 6. Find the smllest integer x > 1 which stisfies ll three congruences x 1 (mod 7) nd x 1 (mod 11) nd x 1 (mod 13). 7. Find complete solution to the system x 2 (mod 5), x 1 (mod 8), x 7 (mod 9), nd x 3 (mod 11). 8. I hve less thn 3 dinrs left in my MobileCom prepid ccount. I could try to spend it ll by sending locl SMSs, for 3 pisters ech, but then 1 pister would be left. Or I could use it ll on interntionl SMSs, 7 pisters ech, then 3 pisters would be left. Or MMSs, 13 pisters ech, nd 2 pisters would be left. How much credits exctly do I hve? 9. Investigte true or flse. () If b (mod n) nd d n then b (mod d). (b) If b (mod n) then gcd(, n) = gcd(b, n). (c) If b (mod n) then m mb (mod mn). (d) If m mb (mod mn) then b (mod n). (e) If m mb (mod n) then b (mod n). 10. Prove 37 (35! 1). 11. Prove 37 (34! 18). 12. Prove tht if is odd then 2 1 (mod 8).

WON 2 Number Theory 11 13. Prove tht if p 1 (mod 3) then p 1 (mod 6). 14. Prove tht if 2 b 2 (mod p) then either b (mod p) or b (mod p). 15. Prove tht if b (mod m) nd b (mod n) then b (mod lcm(m, n)). 16. Prove tht the converse of Wilson s Theorem is lso true. Project 3 Divisibility Tests A number n is divisible by 9 if nd only if the sum of its digits is divisible by 9. For exmple multiple of 9 is the number 1504296 = 9 167144 where the digit sum is 1 + 5 + 0 + 4 + 2 + 9 + 6 = 27, gin multiple of 9. To see why this is true, let n = n (10 n ) + n 1 (10 n 1 ) + + 2 (10 2 ) + 1 (10) + 0 with 0 i 9 for ech term. This simply gives the deciml representtion of n with digits, from right to left, 0, 1, 2,..., n. Since 10 1 (mod 9), Proposition 3.1.3 turns the eqution to the congruence n n + n 1 + + 2 + 1 + 0 (mod 9). Similrly 3k-digit number n is divisible by 7, 11, or 13 if nd ony if the lternting sum of the k consecutive 3-digit substrings of n is divisible by 7, 11, or 13, respectively. To illustrte this let n = 007656103, where the two leding zeros hve been dded to mke the number of digits multiple of 3. We hve 007 656 + 103 = 546 = 2 3 7 13, mening tht n is divisible by 7 nd 13 but not by 11. Exercise. Prove this using the fct tht 1000 1 (mod 7, 11, 13) nd lso prove tht n is divisible by 11 if nd only if the lternting sum of its digits is divisible by 11. Exercise. Given n integer n, remove the right-most digit, sy u, nd denote wht remins by t. Then n is divisible by 17 if nd only if t 5u is, nd by 19 if nd only if t + 2u is. Verify these fcts using severl exmples nd try to prove them. Assignment. Mke summry of Divisibility Tests to determine when number n is divisible by d = 2, 3,..., 19 nd illustrte ech test using your full 9-digit PUN s n. In the end try to fctor n into primes. 4 Modulr Exponentition 4.1 Successive Squring Algorithm An efficient method for computing k % n for lrge integer k is to first express k s the sum of powers of 2, then compute 2 % n, 4 % n, 8 % n,... up to the highest exponent in those summnds. Exercise. Use the lgorithm to compute these residues. 1. 3 99 % 20 2. 25 999 % 9 3. 47 250 % 100 4. 99 100 % 101 4.2 Lemm If gcd(, n) = 1 then {r 1, r 2,..., r n } is complete residue system modulo n if nd only if {r 1, r 2,..., r n } is lso complete residue system modulo n.

WON 2 Number Theory 12 Proof. By Proposition 3.1.4, r j r k (mod n) implies r j r k (mod n) if gcd(, n) = 1, in which cse {r 1, r 2,..., r n } represents distinct congruence clsses modulo n if nd only if {r 1, r 2,..., r n } lso represents distinct congruence clsses modulo n. Exercise. Illustrte this lemm with = 4 nd n = 9. 4.3 Fermt s Little Theorem If p then p 1 1 (mod p). Proof. By Lemm 4.2 the numbers 0,, 2,..., (p 1) form complete residue system modulo p, hence their residues mod p re 0, 1, 2,..., p 1, not necessrily in this order. Leving out 0, we obtin the following congruence by multiplying those numbers. 2 3 (p 1) 1 2 3 (p 1) (mod p) Wilson s Theorem then reduces this to p 1 1 (mod p) nd the desired result. Exercise. Use the theorem to compute these residues. 1. 8 40 % 41 2. 8 42 % 41 3. 8 2345 % 41 4. 5 495 % 239 Definition. The Euler phi-function φ(n) is the number of positive integers up to n which re reltively prime to n. For exmple φ(10) = 4 nd φ(11) = 10. Exercise. Evlute φ(12), φ(13), φ(14), φ(15). Definition. A reduced residue system modulo n is subset of complete residue system modulo n consisting of the φ(n) numbers reltively prime to n. For exmple {1, 2, 4, 5, 7, 8} is reduced residue system modulo 9. Exercise. Find reduced residue system modulo 10, 11, 12, 13. 4.4 Lemm If gcd(, n) = 1 then {r 1, r 2,..., r φ(n) } is reduced residue system modulo n if nd only if {r 1, r 2,..., r φ(n) } is lso reduced residue system modulo n. Proof. As in the proof of Lemm 4.2, either both sets represent distinct congruence clsses or neither does. To finish the proof we need to show tht gcd(r i, n) = 1 if nd only if gcd(r i, n) = 1, but this follows from Proposition 1.8.4 since gcd(, n) = 1. Exercise. Illustrte this lemm with = 4 nd n = 9. 4.5 Euler s Theorem If gcd(, n) = 1 then φ(n) 1 (mod n). Proof. If gcd(, n) = 1 then by Lemm 4.4 we my choose pir of reduced residue systems modulo n in the form {r 1, r 2,..., r φ(n) } nd {r 1, r 2,..., r φ(n) }. Multiplying ll the elements in ech set yields the congruence φ(n) r 1 r 2 r φ(n) r 1 r 2 r φ(n) (mod n) Since ech element r i in the set is reltively prime to n, Proposition 3.1.4 completes the proof by cncelling the common terms off both sides of the congruence.

WON 2 Number Theory 13 Exercise. Compute 7 26 % 10 using Euler s Theorem. Remrk. As computtionl corollry, when gcd(, n) = 1, the computtion of k % n cn be reduced by first replcing by % n nd k by k % φ(n). Euler s Theorem is not true, however, when gcd(, n) 1. Nevertheless for smll n we cn find similr reduction once we observe the periodicity of the sequence % n, 2 % n, 3 % n,... Exercise. Compute the following residues. 1. 2 26 % 10 2. 50 345 % 12 3. 11 123 % 32 4. 77 3456 % 900 4.6 Theorem If gcd(m, n) = 1 then φ(mn) = φ(m)φ(n). Proof. Let M, N, nd MN be reduced residue systems modulo m, n, nd mn, respectively. To complete the proof we shll provide one-to-one correspondence between M N nd MN, thereby showing tht φ(mn) = MN = M N = φ(m)φ(n). For ech MN we hve gcd(, mn) = 1, thus gcd(, m) = 1 nd gcd(, n) = 1. Since M nd N re reduced residue systems, there exists unique pir (c, d) M N such tht c (mod m) nd d (mod n). Conversely given pir of congruences x c (mod m) nd x d (mod n) with (c, d) M N, by Chinese Reminder Theorem nd Proposition 1.6.5, x = is the unique element in MN which solves the system. This estblishes the one-to-one correspondence between the two sets. 4.7 Proposition (Evlution of Euler phi-function) 1. φ(p) = p 1 2. φ(p k ) = p k p k 1 3. If n = p k i i then φ(n) = p k i 1 i (p i 1) = n ( 1 1 p i ). Proof. The clim (1) is trivil. In (2) φ(p k ) is the number of integers from 1 to p k which re reltively prime to p k. Since p is the only prime divisor of p k, this number is p k minus the number of multiples of p, which re p, 2p, 3p,..., (p k 1 )p. Thus φ(p k ) = p k p k 1. And finlly (3) follows directly from (2) nd Theorem 4.6. Exercise. Evlute φ(61), φ(62), φ(63), φ(64). 4.8 A Generliztion of Euler s Theorem Let nd n be rbitrry positive integers. Set n 0 = n nd d 0 = gcd(, n) then for i 1 we define n i nd d i recursively by n i = n i 1 /d i 1 nd d i = gcd(, n i ). If k is the smllest integer for which d k = 1 then φ(n k)+k k (mod n) in which Euler s Theorem coincides with the cse k = 0. Proof. We clim tht the following sttements re ll equivlent, so tht we re done since the very lst one is true by Euler s Theorem. φ(n k)+k k (mod n) φ(n k)+k /d 0 k /d 0 (mod n 1 )

WON 2 Number Theory 14 φ(n k)+k 1 k 1 (mod n 1 ) φ(n k)+k 1 /d 1 k 1 /d 1 (mod n 2 ) φ(n k)+k 2 k 2 (mod n 2 ). φ(n k)+1 /d k 1 /d k 1 (mod n k ) φ(n k) 1 (mod n k ) To justify the equivlence, in ech lternting step down the list we divide through the congruence including the modulus n i by d i to obtin the next modulus n i+1. Immeditely following this we divide the congruence, without the modulus, by /d i. This is llowed by Proposition 3.1.5 s d i = gcd(, n i ) implies gcd(/d i, n i+1 ) = 1 by Proposition 1.6.2. Exercise. Apply this theorem to compute 126 9875 % 432. 4.9 Modulr Root Extrction If both gcd(, n) = 1 nd gcd(e, φ(n)) = 1 then the congruence x e (mod n) hs unique root x d (mod n) where d e 1 (mod φ(n)). Proof. We my write de = 1 + hφ(n) for some integer h. Now rise to the power d both sides of the congruence x e (mod n) to obtin d x de = x 1+hφ(n) = x(x φ(n) ) h x (mod n) using Euler s Theorem. Exercise. Solve for x. 1. x 7 12 (mod 13) 2. x 13 5 (mod 32) 3. x 121 30 (mod 899) 4. x 239 23 (mod 2005) Problem Set 4 1. Find reduced residue system modulo 24. 2. Find reduced residue system modulo 15 with only odd numbers. 3. Evlute φ(250313). 4. Find ll positive integers n stisfying φ(n) = 4. 5. Compute 5 1434 % 307. 6. Compute 25 1434 % 309. 7. Wht will be the right-most digit if we compute 1234 5678? 8. Find the two right-most digits upon computing 123 45678. 9. Solve the congruence x 39 5 (mod 121). 10. Investigte true or flse. () 2 6600 1 (mod 6601) hence the number 6601 must be prime. (b) 2 1762 742 (mod 1763) hence 1763 cnnot be prime number. (c) If b (mod n) then k b k (mod n). (d) If j k (mod n) then j k (mod n). 11. Prove tht Fermt s Little Theorem is equivlent to the following sttement: p (mod p) for ny integer.

WON 2 Number Theory 15 12. Prove tht if k 1 (mod n) for some k > 0 then gcd(, n) = 1. 13. Another property of φ(n) is tht φ(d) = n where the sum is tken over ll the positive integers d which divide n. Verify this property for n = 24 nd n = 30. 14. Prove tht φ(2n) = 2φ(n) if n is even nd φ(2n) = φ(n) if n is odd. 15. Prove tht if d n then φ(d) φ(n). 16. Prove tht φ(n) is even for ll n > 2. Project 4 The RSA Cryptosystem Sensitive messges, when trnsfered over the internet, need to be encrypted, tht is chnged into secret code in such wy tht only the intended receiver who hs the secret key is ble to decrypt it. It is common tht lphbeticl chrcters re converted to their numericl ASCII equivlents before they re encrypted, hence the coded messge will look like integer strings. The RSA Algorithm is n encryptiondecryption process which is widely employed tody. Ali hs number n = pq where p nd q re very lrge distinct primes, over hundred digits ech. She computes φ(n) = φ(pq) = (p 1)(q 1) nd picks number e reltively prime to φ(n) nd nother number d e 1 (mod φ(n)), found vi the Eucliden Algorithm. She gives to Bob the pir (n, e) nd keeps the rest secret. Then whenever Bob wnts to send messge (integer) m < n to Ali, he encrypts it to s = m e % n. Upon receiving s, Ali uses Theorem 4.9 to retrieve the messge by computing m = s d % n. Now if bd guy intercepts the secret messge s, together with e nd n, he will yet hve to find the fctors p nd q in order to compute φ(n). Woe to him, fctoring lrge integer the size of pq will tke lifetime on the best computers of tody. Assignment. Suppose it is known tht e = 3989 nd n = 999697. Using your 6-digit PUN s m, find the encrypted messge s. Then try to brek this code, perhps using Fermt Fctoriztion, nd verify tht you do indeed get m bck. Exercise. Suppose the encrypted messge s is not reltively prime to n. Even though this is highly improbble since n hs only two prime divisors, show tht by Theorem 4.8, the decryption lgorithm will nyhow return the correct messge m. 5 Primitive Roots Definition. Suppose nd n re reltively prime. The order of modulo n is the smllest positive integer k such tht k 1 (mod n). We denote this quntity by n or simply when there is no mbiguity. For exmple 2 7 = 3 becuse k = 3 is the smllest positive solution of the congruence 2 k 1 (mod 7). We reiterte tht n implicitly ssumes tht gcd(, n) = 1, hence we hve n φ(n) by Euler s Theorem. Exercise. Find 3 7, 3 10, 5 12, 7 24. 5.1 Proposition (Properties of orders) 1. If b (mod n) then n = b n. 2. k 1 (mod n) if nd only if n k. In prticulr n φ(n). 3. j k (mod n) if nd only if j k (mod n ).

WON 2 Number Theory 16 4. k = if nd only if gcd(k, ) = 1. 5. If gcd(, b ) = 1 then b = b. Proof. (1) It is cler tht the definition of order extends to congruence clsses. (2) Let j = k/ n so tht we my write k = j n + k % n. Then k = ( n ) j k % n k % n (mod n) nd with the fct k % n < n, the congruence k 1 (mod n) holds if nd only if k % n = 0, equivlently n k. (3) The congruence j k (mod n) is equivlent to j k 1 (mod n) nd the result follows from (2). (4) Observe tht the following congruence jk = ( j ) k = ( k ) j 1 (mod n) is true if we let j =, in which cse k by (2). It is lso true with j = k nd similrly k k. If gcd(k, ) = 1 then by Euclid s Lemm k nd so k =. Conversely if gcd(k, ) = d > 1, since the congruence holds for j = /d, we hve k /d <. (5) Suppose gcd(, b ) = 1. Agin we hve the following congruence. b b = b b (b b ) b = (b) b b 1 (mod n) Hence by (2) b b nd in turn, by Euclid s Lemm b. Now by symmetry b b nd so b b by Proposition 1.6.4. It is cler, however, tht b b so it follows tht b = b. Definition. An integer g is clled primitive root modulo n if g n = φ(n). For exmple 3 is primitive root modulo 7 becuse 3 7 = 6 = φ(7). Exercise. Find ll the primitive roots modulo 6, 7, 8, 9, if ny. 5.2 Proposition (Properties of primitive roots) 1. g is primitive root modulo n if nd only if {g, g 2, g 3,..., g φ(n) } is reduced residue system modulo n. 2. g is primitive root modulo n if nd only if the congruence g x c (mod n) hs solution for every integer c reltively prime to n. 3. If g is primitive root modulo n then so is g k if nd only if gcd(k, φ(n)) = 1. 4. If ny exists, there re exctly φ(φ(n)) primitive roots modulo n. Proof. Let G = {g, g 2, g 3,..., g φ(n) }. (1) If g is primitive root then clerly ech element in G is reltively prime to n. We show now tht they represent distinct congruence clsses, for if g j g k (mod n) then by Proposition 5.1.3, φ(n) (j k). But this reltion is not possible since j k < φ(n) unless j = k. It follows tht G is reduced residue system modulo n. Conversely if g is not primitive root then g k 1 (mod n) with k < φ(n) nd G is not reduced residue system for then g k+1 g (mod n) where both g k+1, g G. (2) Equivlent to (1), G is reduced residue system modulo n if nd only if it represents ll congruence clsses of c with gcd(c, n) = 1.

WON 2 Number Theory 17 (3) This sttement is specil cse of Proposition 5.1.4. (4) Exctly φ(φ(n)) elements g k G stisfy gcd(k, φ(n)) = 1 nd by (3) these nd only these re primitive roots modulo n. 5.3 Theorem The number of solutions of f(x) 0 (mod p) is t most the degree of f. Proof. For liner congruence, x + b 0 (mod p) hs unique solution ccording to the Liner Congruence Theorem since gcd(, p) = 1 nd so the theorem is true. By wy of induction, ssume the clim is true for polynomils of degree up to n 1. Let f(x) be polynomil with leding term x n nd with p. If f(x) hs less thn n roots then there is nothing to prove, else let r 1, r 2,..., r n be distinct roots of f(x) modulo p nd let g(x) = f(x) (x r 1 )(x r 2 ) (x r n ) Note tht the degree of g(x) is less thn n, nd yet it hs the sme n roots of f(x). By induction hypothesis this is impossible unless g(x) is the zero polynomil (mod p), so f(x) (x r 1 )(x r 2 ) (x r n ) (mod p) nd by Proposition 2.1.5 f(x) 0 (mod p) if nd only if x r i (mod p) for one of these roots. Thus f(x) hs only these n roots modulo p. 5.4 Corollry If d (p 1) then the congruence x d 1 (mod p) hs exctly d solutions. Proof. Suppose dk = p 1 so tht we hve the following polynomil identity. x p 1 1 = (x d 1)((x d ) k 1 + (x d ) k 2 + + x d + 1) By Fermt s Little Theorem the left-hnd side hs exctly p 1 roots modulo p. Since p is prime, these roots must come from those of the two polynomils on the right, which by Theorem 5.3 hve t most d nd d(k 1) = p 1 d roots, respectively. The only wy this cn hppen is if their roots re exctly d nd p 1 d. 5.5 Theorem There re exctly φ(p 1) primitive roots modulo every prime p. Proof. In view of Proposition 5.2.4, it suffices to show tht there is t lest one primitive root modulo p. Let p 1 = q e i i where the q s re distinct primes nd e i 1. By Corollry 5.4 there re exctly q e 1 1 integer solutions of x qe 1 1 1 (mod p), ll of which hve orders power of q 1 ccording to Proposition 5.1.2. Similrly, however, q e 1 1 1 of these integers stisfy the congruence x qe 1 1 1 1 (mod p) hence their orders re no more thn q e 1 1 1. It follows tht there exist q e 1 1 q e 1 1 1 integers of order q e 1 1. By symmetry we hve n integer of order q e i i for ech of the distinct prime fctors of p 1. And the product of these integers, by Proposition 5.1.5, is of order p 1, tht is primitive root. Exercise. How mny re primitive roots modulo 5? 7? 11? 89? 5.6 Primitive Root Theorem Primitive roots exist only modulo 1, 2, 4, p k, or 2p k for ny prime p > 2 nd k > 0. No Proof. The proof is set side s n independent ssignment.

WON 2 Number Theory 18 Exercise. Is there primitive root modulo 4? 8? 25? 50? 100? How mny? 5.7 Artin s Conjecture The number 2 is primitive root for infinitely mny primes. 5.8 Discrete Logrithm Problem The congruence x b (mod p) with p b cn be solved by writing nd b s powers of primitive root g modulo p. Exercise. Solve these mod-13 congruences using g = 2 with the help of the given tble. 1. 4 x 10 (mod 13) 2. 5 x 9 (mod 13) 3. 2 7 x 3 (mod 13) 4. 5 8 x 11 (mod 13) k 1 2 3 4 5 6 7 8 9 10 11 12 2 k % 13 2 4 8 3 6 12 11 9 5 10 7 1 Exercise. Use this tble, in similr wy, to solve gin Exercises 3.2.1 nd 4.9.1. Problem Set 5 1. Find the order of 4 modulo 25. 2. Is 5 primitive root modulo 29? 3. Find ll the primitive roots modulo 10. 4. Suppose = 6. Find k for k = 2, 3, 4, 5, 6. 5. One of the primitive roots modulo 11 is 2. Find the rest. 6. Is there primitive root modulo 250313? 7. How mny primitive roots re there modulo 1250? 8. Find three primes modulo which 2 is not primitive root. 9. Solve the congruence 10 6 x 12 (mod 13). 10. Investigte true or flse. () =. (b) If n = b n then b (mod n). (c) If j k (mod n) then j k (mod n). (d) k 1 (mod n) is not possible if gcd(, n) 1. 11. Prove tht if n = n 1 then n must be prime. 12. Prove tht modulr inverses hve equl orders. 13. Prove tht if g is primitive root modulo p > 2 then g (p 1)/2 1 (mod p). 14. Prove tht 4 is not primitive root modulo ny prime. 15. Prove tht the product of two primitive roots modulo p > 2 is not primitive root. 16. Prove tht if p 1 (mod 4) then g is primitive root modulo p if nd only if g is too. Project 5 Secret Key Exchnge For cryptologicl purposes, Ali nd Bob need to estblish common secret key. However, the only vilble mens of communiction between them is the telephone, which they know is being tpped by the enemy. They resort to the Diffie-Hellmn Key Exchnge protocol s follows.

WON 2 Number Theory 19 Ali chooses lrge prime p, primitive root g, nd positive integer m < p. She gives to Bob, over the non-secure telephone line, the numbers p, g, nd g m % p but keeps m secret. In turn Bob selects secret number n nd gives to Ali g n % p. They gree tht their common secret key is g mn % p, which, employing Successive Squring Algorithm, Ali obtins from (g n ) m % p nd Bob, independently, from (g m ) n % p. If the enemy gthers this informtion (but not m nd n for they re not trnsmitted cross) they will hve to solve the congruence g x (mod p) where = g m % p or similrly = g n % p in order to cpture the secret key. But the fct is, there is no efficient lgorithm known to solve this Discrete Logrithm Problem, nd for lrge p the problem is computtionlly infesible. Assignment. Illustrte the bove ide with p = 313, g = 10, m = 97, nd n is the residue mod p of your PUN. After tht pretend you knew neither m nor n nd try to find nother wy to retrieve the secret key g mn % p. Exercise. Will this ide work if g is not primitive root modulo p? Think bout it. 6 Qudrtic Residues Definition. A number which is reltively prime to n is qudrtic residue modulo n if the congruence x 2 (mod n) hs solution. If it hs no solution then is clled qudrtic non-residue modulo n. For exmple 19 is qudrtic residue modulo 5 since 19 2 2 (mod 5) wheres 7 is non-residue becuse x 2 7 (mod 5) hs no solution. Exercise. Find ll the qudrtic residues nd non-residues modulo 5. Definition. Let p be n odd prime. We define the so-clled Legendre symbol s follows. ( ) 1 if is qudrtic residue modulo p = 1 if is qudrtic non-residue modulo p p 0 if p For exmple we hve shown tht ( ) ( ) 19 5 = 1 nd 7 5 = 1. Henceforth the number p in the Legendre symbol ( ) p is understood n odd prime, tht is prime lrger thn 2. 6.1 Proposition (Properties of the Legendre symbol) 1. ( ) ( ) p = b p if b (mod p) 2. ( ) ( ) ( b p = b p p) 3. ( ) p (p 1)/2 (mod p) Euler s Criterion Proof. It is cler tht the definition of qudrtic residue extends to congruence clsses, thus (1). Next we fix primitive root g modulo p nd clim tht g k is qudrtic residue if nd only if k is even. Sufficiency is cler since g k = (g k/2 ) 2 when k is even. For necessity observe tht g j g k (mod p) implies 2 (p 1) (j k) by Proposition 5.1.3 nd so j nd k must be of the sme prity. In prticulr if g k is congruent to squre modulo p then k must be even. By Proposition 5.2.2 we my ssume = g j nd b = g k. Now b = g j+k is qudrtic residue if nd only if j + k is even, tht is both j nd k even or both odd. This is concisely expressed in (2).

WON 2 Number Theory 20 Finlly for the lst clim, ( ) p = 1 if nd only if = g j with j even. But then (g j ) (p 1)/2 = (g j/2 ) p 1 1 (mod p) by Fermt s Little Theorem. Conversely if j is odd, then j 1 is even nd similrly (g j ) (p 1)/2 = (g j 1 g) (p 1)/2 g (p 1)/2 (mod p). However g being primitive root implies tht this lst congruence reduces not to 1, but to 1 (mod p) by Lemm 3.6. 6.2 Corollry ( ) p 1 1 p = ( 1) 2 Proof. The two numbers re congruent modulo p by Euler s Criterion. However, since ech is ±1 nd p > 2, this reltion is possible only when both re equl. Exercise. Is qudrtic residue modulo p? Use different wys to nswer. 1. = 28, p = 5 2. = 48, p = 7 3. = 35, p = 11 4. = 54, p = 13 6.3 Guss Lemm If p then ( ) p = ( 1) n where n is the number of integers in the set {, 2, 3,..., p 1 } whose residues mod p re lrger thn p/2. 2 Proof. Let A denote the set in the bove sttement. Replce ech x > p/2 in the set {1, 2,..., p 1} by x p to obtin nother reduced residue system modulo p, cll it S = {±1, ±2,..., ± p 1 }. Hence n is the number of negtive integers in S which re 2 congruent modulo p to some elements in A. We clim tht for ech pir of elements in A, if j ±k (mod p) then j = k. This is true becuse p so tht the congruence cn be written j ±k (mod p) with j, ±k {1, 2,..., p 1 } S, nd S being reduced residue system forces j = k. This 2 implies tht, modulo p, the elements of A re reordering of the numbers 1, 2,..., p 1, 2 only tht n of them hve negtive sign: 2 3 p 1 2 ( 1) n 1 2 3 p 1 2 (mod p) Cncel out the common terms since they re reltively prime to p nd we hve (p 1)/2 ( 1) n (mod p). Now pply Euler s Criterion to obtin the desired result. Exercise. Illustrte Guss Lemm with = 5 nd p = 11. 6.4 Eisenstein s Lemm If gcd(, 2p) = 1 then ( ) p = ( 1) m where m = (p 1)/2 k=1 k/p. Proof. Our gol is to show tht m is of the sme prity s the number n in Guss Lemm, thereby mking the two lemms equivlent. By definition k = k/p p + k % p where, s in the proof of Guss Lemm, the numbers k % p, for k = 1, 2,..., p 1 re congruent modulo p, perhps not in this 2 order, to 1, 2,..., p 1 but exctly n of them should hve negtive sign. Denote by 2 r s those which should hve been negtives nd the rest by s s so tht p 1 2 p 1 2 n k = k/p p + p r i + k=1 k=1 i=1 p 1 2 n j=1 s j

WON 2 Number Theory 21 On the other hnd we lso hve (p 1)/2 k=1 k = n i=1 r i + (p 1)/2 n j=1 s j nd subtrcting this from the lst eqution yields p 1 2 p 1 2 n n ( 1) k = k/p p + p 2 r i k=1 k=1 i=1 i=1 Since p 1 (mod 2), this in turn gives the congruence 0 (p 1)/2 k=1 k/p + n 0 (mod 2), tht is m n (mod 2) s sought. Exercise. Illustrte Eisenstein s Lemm with = 5 nd p = 11. 6.5 Corollry ( ) p 2 p = ( 1) 2 1 8 Proof. In the previous proof, substitute = 2 in the lst displyed eqution to obtin (p 1)/2 k=1 k (p 1)/2 k=1 2k/p +n 0 (mod 2). But ech ( term ) ( 2k/p ) = 0 becuse 2k < p, wheres the left-hnd side of the congruence is 1 p 1 p+1 2 2 2 = p 2 1 nd the result 8 then follows by Guss Lemm. 6.6 The Lw of Qudrtic Reciprocity If p nd q re distinct odd primes then ( ) ( ) p q = ( 1) ( p 1 2 )( q 1 2 ) q p In other words, ( ) ( ( ) ( ) p q = q p) if p or q 1 (mod 4) nd p q = q p if p q 3 (mod 4). Proof. Let P = {x 1 x p 1 q 1 } nd Q = {y 1 y }. Then P Q contins ( ) ( ) 2 2 p 1 q 1 2 2 elements which cn be prtitioned into two subsets S 1 = {(x, y) P Q py < qx} nd S 2 = {(x, y) P Q py > qx} Note tht py = qx is not possible s p qx. For ech x P we hve (x, y) S 1 if nd only if 1 y qx/p, hence S 1 = (p 1)/2 x=1 qx/p nd similrly S 2 = Now rising 1 to the power P Q = S 1 + S 2 yields ( 1) ( p 1 2 )( q 1 2 ) (p 1)/2 = ( 1) qx/p x=1 ( 1) (q 1)/2 y=1 py/q (q 1)/2 py/q y=1 nd ccording to Eisenstein s Lemm, the right-hnd side of this is ( ( ) q p p) q. Exercise. Evlute the Legendre symbol ( ) p. 1. = 37, p = 83 2. = 71, p = 103 3. = 69, p = 127 4. = 816, p = 239

WON 2 Number Theory 22 Definition. Let P = p 1 p 2 p k be the product of odd prime numbers, not necessrily distinct. Define the Jcobi symbol ( ) ( ) ( ) ( ) = P p 1 nd for convenience lso let ( ) ( ( ) ( ) ( ) ( ) 1 = 1. For exmple 14 825) = 14 14 14 14 3 5 5 11. In the cse k = 1, Jcobi symbol is relly Legendre symbol. Moreover if gcd(, P ) = 1 then the vlue of ( ) ( ) P is ±1, nd 0 otherwise. It is lso true tht if P = 1 then is qudrtic non-residue modulo P, but the converse is not necessrily true. Exercise. Is 14 qudrtic residue modulo 825? 6.7 Proposition (Properties of the Jcobi symbol) 1. ( ) ( ) P = b P if b (mod P ) 2. ( ) ( ) ( ) b P = b P P 3. ( ( ) ( ) P Q) = P Q Proof. The congruence b (mod P = p 1 p 2 p k ) implies b (mod p i ) for ech prime p i. Thus ( ) ( ) ( ) ( ) ( ) ( ) ( ) b b b = = = P p 1 p 2 p k p 2 p 1 p 2 p k p k ( ) b P by Proposition 6.1.1. This proves (1). In very similr wy (2) follows from Proposition 6.1.2, nd (3) stright from the definition of Jcobi symbol. 6.8 The Generlized Lw of Qudrtic Reciprocity Suppose P, Q > 0 re odd. 1. ( 1 P 2. ( 2 P 3. ( P Q) ( Q P ) P 1 = ( 1) 2 ) P = ( 1) 2 1 8 ) = ( 1) ( P 1 2 )( Q 1 2 ) No Proof. The proof is set side s n independent ssignment. Exercise. Evlute ( ) p with the help of Jcobi symbol. 1. = 21, p = 61 2. = 35, p = 103 3. = 69, p = 127 4. = 816, p = 239 6.9 Modulr Squre Root If is qudrtic residue modulo p 3 (mod 4) then the congruence x 2 (mod p) hs exctly two solutions given by x ± (p+1)/4 (mod p). Proof. Using Euler s Criterion, ( (p+1)/4 ) 2 = (p+1)/2 = (p 1)/2 ( ) p = (mod p). Hence x 2 (mod p) implies x ± (p+1)/4 (mod p) by Problem 3.14 nd these two solutions re distinct since p 2. Exercise. Find ll solutions.

WON 2 Number Theory 23 1. x 2 2 (mod 23) 2. x 2 2x + 3 0 (mod 11) 3. x 2 10 (mod 21) 4. x 2 31 (mod 55) Problem Set 6 1. Find ll the qudrtic residues nd non-residues modulo 11. 2. Evlute the Legendre symbol ( ) 7 11 using () Euler s Criterion (b) Guss Lemm (c) Eisenstein s Lemm (d) Qudrtic Reciprocity Lw. 3. Does the congruence x 2 186 (mod 557) hve solution? 4. Does the congruence x 2 6x 2 (mod 79) hve solution? 5. Does the congruence x 2 5x + 2 0 (mod 29) hve solution? 6. Evlute the Jcobi symbol ( ) 218 385. 7. Chrcterize the prime numbers modulo which 5 is qudrtic residue. 8. Find ll solutions of the congruence x 2 8 (mod 31). 9. Find ll solutions of the congruence 2x 2 + x + 2 0 (mod 31). 10. Find ll solutions of the congruence x 2 29 (mod 35). 11. Investigte true or flse. () ( ) 713 1009 = 1 thus 713 is qudrtic residue modulo 1009. (b) ( ) 442 751 = 1 thus 442 is qudrtic non-residue modulo 751. (c) ( ) 2 15 = 1 thus 2 is qudrtic residue modulo 15. (d) ( ) 7 15 = 1 thus 7 is qudrtic non-residue modulo 15. 12. Suppose tht is reltively prime to n odd prime p. Prove tht the congruence x 2 (mod p) hs either exctly two solutions or none. 13. Prove tht 1 is qudrtic residue modulo p > 2 if nd only if p 1 (mod 4). 14. Prove tht 2 is qudrtic residue modulo p > 2 if nd only if p ±1 (mod 8). 15. Prove tht 2 is qudrtic residue modulo p > 2 if nd only if p 1, 3 (mod 8). 16. Prove tht 3 is qudrtic residue modulo p > 2 if nd only if p 1 (mod 6). Project 6 Electronic Coin Tossing In gme of coin tossing, two plyers hve fifty-fifty chnce of winning by betting on the outcome, either Hed or Til. How cn this gme be plyed electroniclly, over emil for instnce? Ali knows two lrge primes p q 3 (mod 4) nd sends the product n = pq to Bob. In turn Bob chooses n integer h < n nd sends = h 2 % n to Ali. Using 6.9 nd Chinese Reminder Theorem, Ali is ble to solve x 2 (mod n) nd finds four roots in the forms x ±h, ±t (mod n). Ali now guesses Bob s number, either h or t. If Ali sends h to Bob, Ali wins. If, however, she picks t then Bob wins nd he proves it by returning to her the fctors p, q, one of which equls gcd(h + t, n), hence cn be computed in no time using the Eucliden Algorithm. Exercise. Verify tht the congruence x 2 (mod pq) hs indeed four roots whose residues mod pq equl h, pq h, t, pq t. Also prove tht gcd(h + t, pq) = p or q. Assignment. Illustrte the bove discussion using h your 6-digit PUN nd n = 999697, which supposedly you hve fctored into two primes bck in Project 4. First compute = h 2 % n then find the four roots of x 2 (mod n) nd finlly verify tht gcd(h+t, n) is one of the two prime fctors of n.