Calculators will not be permitted on the exam. The numbers on the exam will be suitable for calculating by hand.

Similar documents
Calculators will not be permitted on the exam. The numbers on the exam will be suitable for calculating by hand.

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

Solutions for the Practice Questions

Number Theory/Cryptography (part 1 of CSC 282)

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

Practice Midterm 2 Solutions

Data security (Cryptography) exercise book

Numbers (8A) Young Won Lim 5/24/17

Math 255 Spring 2017 Solving x 2 a (mod n)

Numbers (8A) Young Won Lim 6/21/17

Numbers (8A) Young Won Lim 5/22/17

Number Theory. Konkreetne Matemaatika

Wilson s Theorem and Fermat s Theorem

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

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

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

Math 127: Equivalence Relations

SOLUTIONS FOR PROBLEM SET 4

SOLUTIONS TO PROBLEM SET 5. Section 9.1

Introduction. and Z r1 Z rn. This lecture aims to provide techniques. CRT during the decription process in RSA is explained.

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

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

Solutions for the Practice Final

MA/CSSE 473 Day 9. The algorithm (modified) N 1

Applications of Fermat s Little Theorem and Congruences

Solutions for the 2nd Practice Midterm

CMPSCI 250: Introduction to Computation. Lecture #14: The Chinese Remainder Theorem David Mix Barrington 24 February 2012

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

NUMBER THEORY AMIN WITNO

Fermat s little theorem. RSA.

Modular Arithmetic. Kieran Cooney - February 18, 2016

The congruence relation has many similarities to equality. The following theorem says that congruence, like equality, is an equivalence relation.

Modular Arithmetic. claserken. July 2016

Cryptography. 2. decoding is extremely difficult (for protection against eavesdroppers);

Linear Congruences. The solutions to a linear congruence ax b (mod m) are all integers x that satisfy the congruence.

Introduction to Modular Arithmetic

Carmen s Core Concepts (Math 135)

Solutions to Problem Set 6 - Fall 2008 Due Tuesday, Oct. 21 at 1:00

Math 412: Number Theory Lecture 6: congruence system and

Cryptography Math 1580 Silverman First Hour Exam Mon Oct 2, 2017

Cryptography, Number Theory, and RSA

Discrete Square Root. Çetin Kaya Koç Winter / 11

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.

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

MATH 13150: Freshman Seminar Unit 15

The Chinese Remainder Theorem

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

Primitive Roots. Chapter Orders and Primitive Roots

LECTURE 7: POLYNOMIAL CONGRUENCES TO PRIME POWER MODULI

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.

Congruence. Solving linear congruences. A linear congruence is an expression in the form. ax b (modm)

Outline Introduction Big Problems that Brun s Sieve Attacks Conclusions. Brun s Sieve. Joe Fields. November 8, 2007

MODULAR ARITHMETIC II: CONGRUENCES AND DIVISION

Final exam. Question Points Score. Total: 150

Distribution of Primes

CMath 55 PROFESSOR KENNETH A. RIBET. Final Examination May 11, :30AM 2:30PM, 100 Lewis Hall

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

Q(173)Q(177)Q(188)Q(193)Q(203)

Constructions of Coverings of the Integers: Exploring an Erdős Problem

Problem Set 6 Solutions Math 158, Fall 2016

Public Key Cryptography Great Ideas in Theoretical Computer Science Saarland University, Summer 2014

Mathematics Explorers Club Fall 2012 Number Theory and Cryptography

MAT199: Math Alive Cryptography Part 2

Modular Arithmetic: refresher.

CHAPTER 2. Modular Arithmetic

Example Enemy agents are trying to invent a new type of cipher. They decide on the following encryption scheme: Plaintext converts to Ciphertext

Discrete Math Class 4 ( )

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

MAT Modular arithmetic and number theory. Modular arithmetic

Sheet 1: Introduction to prime numbers.

6.2 Modular Arithmetic

Lecture 32. Handout or Document Camera or Class Exercise. Which of the following is equal to [53] [5] 1 in Z 7? (Do not use a calculator.

EE 418 Network Security and Cryptography Lecture #3

Discrete Mathematics & Mathematical Reasoning Multiplicative Inverses and Some Cryptography

Algorithmic Number Theory and Cryptography (CS 303)

EE 418: Network Security and Cryptography

1.6 Congruence Modulo m

Math 1111 Math Exam Study Guide

The Chinese Remainder Theorem

MT 430 Intro to Number Theory MIDTERM 2 PRACTICE

Multiples and Divisibility

The Chinese Remainder Theorem

Public Key Encryption

MATH 324 Elementary Number Theory Solutions to Practice Problems for Final Examination Monday August 8, 2005

An elementary study of Goldbach Conjecture

Overview. The Big Picture... CSC 580 Cryptography and Computer Security. January 25, Math Basics for Cryptography

Lecture 8. Outline. 1. Modular Arithmetic. Clock Math!!! 2. Inverses for Modular Arithmetic: Greatest Common Divisor. 3. Euclid s GCD Algorithm

MAT 302: ALGEBRAIC CRYPTOGRAPHY. Department of Mathematical and Computational Sciences University of Toronto, Mississauga.

1 = 3 2 = 3 ( ) = = = 33( ) 98 = = =

PROPERTIES OF MERSENNE NUMBERS AND PRIMES

Math 1111 Math Exam Study Guide

ON MODULI FOR WHICH THE FIBONACCI SEQUENCE CONTAINS A COMPLETE SYSTEM OF RESIDUES S. A. BURR Belt Telephone Laboratories, Inc., Whippany, New Jersey

Final Exam, Math 6105

Application: Public Key Cryptography. Public Key Cryptography

ALGEBRA: Chapter I: QUESTION BANK

Xor. Isomorphisms. CS70: Lecture 9. Outline. Is public key crypto possible? Cryptography... Public key crypography.

SESAME Modular Arithmetic. MurphyKate Montee. March 2018 IN,Z, We think numbers should satisfy certain rules, which we call axioms:

by Michael Filaseta University of South Carolina

Class 8: Factors and Multiples (Lecture Notes)

Goldbach Conjecture (7 th june 1742)

Transcription:

Midterm #: practice MATH Intro to Number Theory midterm: Thursday, Nov 7 Please print your name: Calculators will not be permitted on the exam. The numbers on the exam will be suitable for calculating by hand. Problem. For unknown reasons, the high priest of number theory has banned usage of the Euclidean algorithm. With the help of the Chinese remainder theorem, determine the modular inverse of 49 modulo 666. Note that 666 = 9 7. We rst compute 49 modulo each of ; 9; 7. That's super easy: 49 (mod ), 49 5 (mod 9) and 49 (mod 7). By the Chinese remainder theorem, 49 97[(9 7) mod +7[( 7) mod 9 5 +9[( 9) mod 7 +740 6077 (mod666): Problem. Compute 7 (mod 90) in the following three dierent ways: (a) Directly, using binary exponentiation. (b) With the help of Euler's theorem. (c) With the help of the Chinese remainder theorem (as well as Euler's theorem). (a) Modulo 90, we have 7 = 49, 7 4 = 49 6, 7 8 6, 7 6 6, 7, 7 64 6. Therefore, 7 = 7 64 7 7 8 7 4 7 7 6 6 49 7 7 (mod 90). (b) Since 90 = 5, we nd (90) = 90 5 = 4 so that Euler's theorem tells us that 7 4 (mod 90). Since 5 (mod 4), we have 7 7 5 = 7 8 7 4 7 7 6 49 7 7 (mod 90).

(c) Notice that 90 = 5, where ; 9; 5 are pairwise coprime. Computing 7 modulo each of ; 9; 5 is much easier (note that (9) = 9 = 6 so that, by Euler's theorem 7 6 (mod 9); on the other hand, 7 4 (mod 5)): 7 (mod ); 7 7 ( ) (mod 9); 7 7 (mod 5): By the Chinese remainder theorem, 7 9 5 [(9 5) mod + 5 [( 5) mod 9 + 9 [( 9) mod 5 45 + 0 + 08 7 (mod 90): Comment. While this might seem like the most involved approach (it certainly requires the most expertise), observe that the actual computations are much simpler than in the other cases (because we are operating modulo very small numbers). Problem. Note that = 7 9. (a) Modulo, what do we learn from Euler's theorem? (b) Using the Chinese remainder theorem, show that x 44 (mod ) for all x coprime to. (c) Compare the two results! Bonus: Can you come up with a strengthening of Euler's theorem? (a) Since () = 7 9 = 88, we learn that x 88 (mod ) for all x that are coprime to. (b) By the Chinese remainder theorem, the congruence x 44 (mod ) is true for all x coprime to (or, equivalently, all x coprime to both 7 and 9) if and only if the two congruences x 44 (mod 7) and x 44 (mod 9) are true for all such x. By Fermat's little theorem, we have x 6 (mod 7) and hence x 44 (x 6 ) 9 (mod 7). Likewise, x 8 (mod 9) implies that x 44 (x 8 ) 8 (mod 9). (c) If x 44 (mod ), then x 88 = (x 44 ) (mod ). This means that Euler's theorem is weaker than the congruence we obtained using the Chinese remainder theorem. This leads us to the following strengthening of Euler's theorem. If the prime factorization of n is n = p k p r k r, then x f(n) (mod n), where f(n) = lcm('(p k ); '(p k ); :::; '(p r k r )): Advanced comment. This f(n) is almost the minimal value (n) such that x (n) (mod n). The only improvement that can be made is that, in the above, '( m ) may be replaced with '(m ) if m >. This is known as Carmichael's theorem.

Problem 4. Let a; b be positive integers. (a) Suppose that x a (mod n) and x b (mod n). Show that x gcd(a;b) (mod n). (b) Use the previous result to nd all solutions to x 0 (mod 07). (c) On the other hand, there are 6 solutions to x 0 (mod 06). What is dierent in this case? (a) By Bezout's identity, we nd integers r; s such that ra + sb = gcd(a; b). Hence, x gcd(a;b) = x ra+sb = (x a ) r (x b ) s r s (mod n): (b) Note that a solution x is necessarily coprime to 07. (Why?!) By Fermat's little theorem, x 06 (mod 07). Since gcd(06; 0) =, we conclude that x (mod 07). Since 07 is a prime, this congruence has only the solutions x (mod 07). (We established this in Problem of Homework 4. Make sure that you recall the argument and why it is crucial that 07 is a prime.) (c) Again, a solution x is necessarily coprime to 06. By Euler's theorem, x 576 (mod 06). Since gcd(576; 0) =, we conclude that x (mod 06). However, 06 is not a prime and so this congruence actually has more solutions than just x (mod 06). Comment. In fact, it has the 6 solutions ; 7; 4; 449; 559; 575; 88; 007; 009; 5; 44; 457; 567; 58; 889; 05 modulo 06. Clearly, each of these also solves x 0 (mod 06). Problem 9 below makes it transparent where these extra solutions are coming from. In short, by the Chinese remainder theorem, the congruence modulo 06 = 5 7 breaks into congruences modulo 5, and 7; in each of these three cases, we get at least the two solutions, which we can combine in = 8 dierent ways to get 8 solutions modulo 06. That we actually have 6 = 4 solutions modulo 06 is due to the fact that x (mod 5 ) actually has 4 instead of just solutions (namely, x ; 5 (mod 5 )). Problem 5. (a) You wonder whether ; 660; 9 is a prime. A (comparatively) quick computation shows that 6608 064778 (mod 6609). What do you conclude? (b) You wonder whether 9; 96; 80 is a prime. A quick computation shows that 996800 (mod 99680). What do you conclude? (a) This proves that 6609 is not a prime. Because, if it was a prime, then 6608 (mod 6609) by Fermat's little theorem. [Indeed, 6609 = 69 5; but nding that factorization is a more dicult task! (b) We still don't know whether 99680 is a prime or not. There is two possibilities: either 99680 is a prime, or 99680 is a pseudoprime to base (people also say that is a Fermat liar in that case). [Actually, 99680 is a prime.

Problem 6. (a) Using Fermat's little theorem and base, show that 4 is not a prime. (b) Is 4 a pseudoprime to the base? These computations are tedious to do by hand. Do make sure though that the idea and the procedure are clear. (a) 40 56 / (mod 4) so that, by Fermat's little theorem, 4 cannot be a prime. Of course, computing that 40 56 (mod 4) requires some work. In the absence of knowing the prime factorization of 4, we resort to direct binary exponentiation (see comment below) and 40 = (00000) = 56 + 64 + 6 + 4. Here are the intermediate values we get modulo 4: 9, 4 8, 8 8, 6 45, 9 (so that, now, the values repeat), 64 8, 8 8, 56 45. Useful observation. Note that we could have saved some work by exploiting (mod 4), which implies 0 (mod 4). Since 40 0 (mod 0), we nd that 40 0 = 8 56 (mod 4). (b) We need to compute 40 (mod 4). We proceed using binary exponentiation as in the previous part. The values we get modulo 4 are: = 4, 4 = 6, 8 = 56, 6 = 64, = 4, so that, again, values repeat. In the end, we nd that 40 (mod 4). This means that 4 is a pseudoprime to the base (because we already know that 4 is not an actual prime). Useful observation. Again, we can save a lot of work by exploiting (mod 4), which implies 0 (mod 4). As before, we conclude that 40 0 = 8 (mod 4). Comment. If we know the factorization of 4 then we can cut down on our work a little bit by using the Chinese remainder theorem and Euler's theorem (but realize that if we have to ask questions like whether 4 is a prime, then we wouldn't know this factorization and wouldn't be able to apply these theorems). Problem 7. (a) Among the numbers ; ; :::; 06, how many are coprime to 06? (b) Carefully state Euler's theorem. (c) If the prime factorization of n is n = p k p r k r, what does (n) evaluate to? (d) Carefully state Wilson's theorem. (a) This just asks for (06). (b) If n > and gcd(a; n) =, then a (n) (mod n). k (c) If the prime factorization of n is n = p k p r r, then (n) = n p pr. (d) If p is a prime, then (p )! (mod p). Problem 8. (a) What does it mean for n to be a pseudoprime to base a? (b) What does it mean for n to be an absolute pseudoprime? (c) Outline the Fermat primality test. What makes this a heuristic test? 4

(a) It means that n is composite but satises a n a (mod n). In other words, it behaves like a prime would by Fermat's little theorem. Sometimes the condition a n a (mod n) is replaced with a n (mod n). That makes no dierence unless gcd(a; n) =/ (in which case we learned about a divisor of n). (b) These are numbers which are pseudoprime to any base a >. (c) Fermat primality test: Input: number n and parameter k indicating the number of tests to run Output: not prime or possibly prime Algorithm: Repeat k times: Pick a random number a from f; ; :::; n g. If a n / (mod n), then stop and output not prime. Output possibly prime. The test is heuristic because it is not designed to decide with absolute certainty whether a number is a prime. More specically, if it claims that a number is composite, then we actually do have certainty that the number is indeed composite (but don't know its factors). But the test is unable to prove that a number is prime; if we choose the number of iterations k large enough, then we have strong reason to believe that n is a prime (if we do not deal with an absolute pseudoprime [which are very rare then there is only a probability of k that we mistakenly label a composite number as probably prime). Problem 9. (a) Using the Chinese remainder theorem, determine all solutions to x (mod 05). (b) Can you predict how many solutions the congruence x (mod 0) is going to have? (a) Note that 05 = 5 7. By the Chinese remainder theorem, x is a solution to x (mod 05) if and only if x is a solution to the three congruences x (mod ); x (mod 5); x (mod 7): Since ; 5; 7 are primes each of these only has the obvious solutions x. (Again, we established this in Problem of Homework 4.) Using the Chinese remainder theorem, these combine in = 8 dierent ways to a solution modulo 05. For instance, one the 8 possibilities is x (mod ); x (mod 5); x (mod 7) () x 5 7 [(5 7) mod + 7 [( 7) mod 5 5 [( 5) mod 7 = 70 + 5 4 (mod 05): Corresponding to it is the negative case x (mod ), x (mod 5), x (mod 7) which is equivalent to x 4 (mod 05). Likewise, we determine all 8 solutions as follows: x (mod ); x (mod 5); x (mod 7) () x (mod 05) x (mod ); x (mod 5); x (mod 7) () x 9 (mod 05) x (mod ); x (mod 5); x (mod 7) () x 4 (mod 05) x (mod ); x (mod 5); x (mod 7) () x 4 (mod 05) x (mod ); x (mod 5); x (mod 7) () x 4 (mod 05) x (mod ); x (mod 5); x (mod 7) () x 4 (mod 05) x (mod ); x (mod 5); x (mod 7) () x 9 (mod 05) x (mod ); x (mod 5); x (mod 7) () x (mod 05) 5

Note that, because each case has a negative, we only need to compute 4 of these 8 cases. In summary, x (mod 05) has exactly the 8 solutions x ; 9; 4; 4 modulo 05. (b) Since 0 = 5 7, we can again use the Chinese remainder theorem and argue as in the previous case. There is just one dierence: the congruence x (mod ) only has solution (because (mod )). Hence, we nd that the congruence x (mod 0) has = 8 solutions. A variation. On the other hand, x (mod 5 7 9) will have = 6 solutions. Problem 0. (a) Which number is represented by the continued fraction [; ; ; ; ;? (b) Determine all convergents of [; ; ; ; ;. (c) Which number is represented by the innite continued fraction [; ; ; ; ; ; ; ; :::? (d) Compare, numerically, the rst six convergents (computed above) to the value of the innite continued fraction. (a) [; ; ; ; ; = + + + + + = 4 0 Comment. Of course, we can simplify this continued fraction directly. But that is a bit time consuming and prone to errors. A better is way is to compute the convergents recursively as we do in the next part. (b) The convergents are C 0 =, C = [; = + =, C = [; ; = + We can continue like that but the computations will get more involved. Instead, we should proceed recursively. Recall from class that the convergents C n = pn of [a q 0 ; a ; a ; ::: are characterized by n + = 4. p k = a k p k + p k with p = 0; p = and q k = a k q k + q k with q = ; q = 0 : The corresponding calculations of p n and q n are as follows: (c) Write x = [; ; ; ; ; ; ; ; :::. Then, x = + n 0 4 5 a n p n 0 4 5 4 q n 0 8 0 C n + + 4 + + ::: 8 5 4 0 = +. + x The equation x = + simplies to x = x. Further (note that, clearly x =/ so that x + =/ 0) + x + x simplies to (x )(x + ) = x or x x = 0, which has the solutions x = p 4 + 8 = p. Since + p.66 and p 4 p 0.66, we conclude that [; ; ; ; ; ; ; ; ::: = +. (d) C 0 =, C = =.5, C = 4., C = 8 =.75, C 4 = 5.64, C 5 = 4 0.67 6

These values quickly approach + p.66 in the expected alternating fashion. Problem. (a) Express the numbers 5 7 and as a simple continued fraction. 9 (b) Is this the unique simple continued fraction representing 5 9? Explain! (a) The simplest way to obtain the continued fraction for 5 is via the Euclidian algorithm: 9 5 = 9 + 59; 9 = 59 + 6; 59 = 6 + ; 6 = + 5; = 5 + ; 5 = 5 + 0 Hence, 5 = [; ; ; ; ; 5. 9 To determine a simple continued fraction for 7 using the Euclidian algorithm applied to 05. 7 05, we rst write = + = + = 05 + ; 05 = 9 + 6; = 6 + 5; 6 = 5 + ; 5 = 5 + 0: 05. We then proceed Combined, 7 = [ ; ; 9; ; ; 5. (b) No, a nite continued fraction can always be expressed in two ways because of the simple relation [a 0 ; a ; a ; :::; a n = [a 0 ; a ; a ; :::; a n ;, assuming a n >. In this case, we also have 5 = [; ; ; ; ; 4;. 9 It is also a very good idea to review the problems from Homework 5 as well as the previous practice problems. 7