Euler s Totient Theorem

Similar documents
8 Primes and Modular Arithmetic

Applications of Fermat s Little Theorem and Congruences

The Euclidean Algorithm

MATH 13150: Freshman Seminar Unit 10

Stupid Divisibility Tricks

Lecture 13 - Basic Number Theory.

Just the Factors, Ma am

Clock Arithmetic and Modular Systems Clock Arithmetic The introduction to Chapter 4 described a mathematical system

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

Math 319 Problem Set #3 Solution 21 February 2002

Computing exponents modulo a number: Repeated squaring

2.5 Zeros of a Polynomial Functions

FRACTIONS MODULE Part I

Factoring Whole Numbers

RSA Encryption. Tom Davis October 10, 2003

Math Workshop October 2010 Fractions and Repeating Decimals

No Solution Equations Let s look at the following equation: 2 +3=2 +7

Revised Version of Chapter 23. We learned long ago how to solve linear congruences. ax c (mod m)

Our Primitive Roots. Chris Lyons

Grade 6 Math Circles March 10/11, 2015 Prime Time Solutions

Some practice problems for midterm 2

Cryptography and Network Security Number Theory

Greatest Common Factor and Least Common Multiple

Number Theory. Proof. Suppose otherwise. Then there would be a finite number n of primes, which we may

Primes in Sequences. Lee 1. By: Jae Young Lee. Project for MA 341 (Number Theory) Boston University Summer Term I 2009 Instructor: Kalin Kostadinov

Chapter 11 Number Theory

Session 7 Fractions and Decimals

V Quantitative Reasoning: Computers, Number Theory and Cryptography

Vieta s Formulas and the Identity Theorem

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, Notes on Algebra

Note on some explicit formulae for twin prime counting function

THE NUMBER OF REPRESENTATIONS OF n OF THE FORM n = x 2 2 y, x > 0, y 0

0.8 Rational Expressions and Equations

SECTION 10-2 Mathematical Induction

= = 3 4, Now assume that P (k) is true for some fixed k 2. This means that

An Introduction to the RSA Encryption Method

The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.

15 Prime and Composite Numbers

Section 4.1 Rules of Exponents

SUM OF TWO SQUARES JAHNAVI BHASKAR

Public Key Cryptography: RSA and Lots of Number Theory

The application of prime numbers to RSA encryption

Activity 1: Using base ten blocks to model operations on decimals

Overview of Number Theory Basics. Divisibility

Cryptography and Network Security Chapter 8

Quotient Rings and Field Extensions

Some facts about polynomials modulo m (Full proof of the Fingerprinting Theorem)

Grade 7/8 Math Circles Fall 2012 Factors and Primes

GCDs and Relatively Prime Numbers! CSCI 2824, Fall 2014!

If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C?

POLYNOMIAL FUNCTIONS

Heron Triangles. by Kathy Temple. Arizona Teacher Institute. Math Project Thesis

5544 = = = Now we have to find a divisor of 693. We can try 3, and 693 = 3 231,and we keep dividing by 3 to get: 1

Five fundamental operations. mathematics: addition, subtraction, multiplication, division, and modular forms

The Chinese Remainder Theorem

MATH 537 (Number Theory) FALL 2016 TENTATIVE SYLLABUS

The Factor Theorem and a corollary of the Fundamental Theorem of Algebra

3 cups ¾ ½ ¼ 2 cups ¾ ½ ¼. 1 cup ¾ ½ ¼. 1 cup. 1 cup ¾ ½ ¼ ¾ ½ ¼. 1 cup. 1 cup ¾ ½ ¼ ¾ ½ ¼

Ummmm! Definitely interested. She took the pen and pad out of my hand and constructed a third one for herself:

Tests for Divisibility, Theorems for Divisibility, the Prime Factor Test

4.5 Finite Mathematical Systems

Homework 2 Solutions

Cryptography and Network Security Department of Computer Science and Engineering Indian Institute of Technology Kharagpur

Calculate Highest Common Factors(HCFs) & Least Common Multiples(LCMs) NA1

Working with whole numbers

PYTHAGOREAN TRIPLES KEITH CONRAD

CONTENTS. Please note:

Computer and Network Security

Principles of Public Key Cryptography. Applications of Public Key Cryptography. Security in Public Key Algorithms

Properties of Real Numbers

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6

Maths Workshop for Parents 2. Fractions and Algebra

Prime Factorization 0.1. Overcoming Math Anxiety

3.1. RATIONAL EXPRESSIONS

Primes. Name Period Number Theory

Discrete Mathematics, Chapter 4: Number Theory and Cryptography

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

SOLUTIONS FOR PROBLEM SET 2

Prime Time: Homework Examples from ACE

1. The RSA algorithm In this chapter, we ll learn how the RSA algorithm works.

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

Week 13 Trigonometric Form of Complex Numbers

Lesson 4. Factors and Multiples. Objectives

A Prime Investigation with 7, 11, and 13

Lecture 13: Factoring Integers

Determine If An Equation Represents a Function

Previously, you learned the names of the parts of a multiplication problem. 1. a. 6 2 = 12 6 and 2 are the. b. 12 is the

8 Divisibility and prime numbers

47 Numerator Denominator

Dr Brian Beaudrie pg. 1

north seattle community college

3 Some Integer Functions

Overview of Public-Key Cryptography

Solving Linear Equations in One Variable. Worked Examples

Zero: If P is a polynomial and if c is a number such that P (c) = 0 then c is a zero of P.

Introduction to Fractions, Equivalent and Simplifying (1-2 days)

Grade 6 Math Circles. Binary and Beyond

Playing with Numbers

Math 453: Elementary Number Theory Definitions and Theorems

MILS and MOA A Guide to understanding what they are and How to derive the Range Estimation Equations

Transcription:

Euler s Totient Theorem Misha Lavrov ARML Practice 11/11/2012

Example We want to be able to solve the following type of problem: Problem (VTRMC 2012/4.).. 3 What are the last two digits of 3 33. }{{} 2012 times?

Review of modular arithmetic We say that a b (mod m) if the difference a b is divisible by m. Also, a mod m is defined to be the unique b in the set {0, 1, 2,..., m 1} such that a b (mod m).

Review of modular arithmetic We say that a b (mod m) if the difference a b is divisible by m. Also, a mod m is defined to be the unique b in the set {0, 1, 2,..., m 1} such that a b (mod m). We are allowed to add, subtract, multiply modular equations just like regular equations. However, division does not always work: 4 14 (mod 10) but 4/2 14 /2 (mod 10).

Review of modular arithmetic We say that a b (mod m) if the difference a b is divisible by m. Also, a mod m is defined to be the unique b in the set {0, 1, 2,..., m 1} such that a b (mod m). We are allowed to add, subtract, multiply modular equations just like regular equations. However, division does not always work: 4 14 (mod 10) but 4/2 14 /2 (mod 10). Our goal is to find out how to simplify a b mod m.

Powers modulo a prime Problem What is 3 2012 mod 17?

Powers modulo a prime Problem What is 3 2012 mod 17? Solution The powers of 3 mod 17 go around in a circle like this: 10 9 3 1 6 13 2 5 12 15 4 11 16 14 8 7 Since 2012 = 125 16 + 12, 3 2012 3 12 4 (mod 17).

Questions How could we have guessed ahead of time that there would be 16 steps around the circle?

Questions How could we have guessed ahead of time that there would be 16 steps around the circle? Answer: The 16 steps are the remainders {1,..., 16}. Since 3 k is never divisible by 17, those are all we can get.

Questions How could we have guessed ahead of time that there would be 16 steps around the circle? Answer: The 16 steps are the remainders {1,..., 16}. Since 3 k is never divisible by 17, those are all we can get. Is it possible that we loop around without hitting all the remainders?

Questions How could we have guessed ahead of time that there would be 16 steps around the circle? Answer: The 16 steps are the remainders {1,..., 16}. Since 3 k is never divisible by 17, those are all we can get. Is it possible that we loop around without hitting all the remainders? Answer: Yes. For example, the values of 2 k mod 17 are 2 4 8 16 15 13 9 1 2.

Questions How could we have guessed ahead of time that there would be 16 steps around the circle? Answer: The 16 steps are the remainders {1,..., 16}. Since 3 k is never divisible by 17, those are all we can get. Is it possible that we loop around without hitting all the remainders? Answer: Yes. For example, the values of 2 k mod 17 are 2 4 8 16 15 13 9 1 2. Can the loops be of any size less than 16?

Questions How could we have guessed ahead of time that there would be 16 steps around the circle? Answer: The 16 steps are the remainders {1,..., 16}. Since 3 k is never divisible by 17, those are all we can get. Is it possible that we loop around without hitting all the remainders? Answer: Yes. For example, the values of 2 k mod 17 are 2 4 8 16 15 13 9 1 2. Can the loops be of any size less than 16? Answer: No. Consider the values of 3 2 k mod 17: 3 6 12 7 14 11 5 10 3. This loop has the same length, but never meets the other loop. All such loops together must add up to 16, so their length divides 16. In particular, a 16 mod 17 is always 1.

Fermat s Little Theorem Theorem (Fermat s Little Theorem) If p is a prime, then for any integer a not divisible by p, a p 1 1 (mod p). Corollary We can factor a power a b as some product a p 1 a p 1 a p 1 a c, where c is some small number (in fact, c = b mod (p 1)). When we take a b mod p, all the powers of a p 1 cancel, and we just need to compute a c mod p.

Fermat s Little Theorem: Exercises Problem (1972 AHSME #31) The number 2 1000 is divided by 13. What is the remainder?

Fermat s Little Theorem: Exercises Problem (1972 AHSME #31) The number 2 1000 is divided by 13. What is the remainder? Solution We know that 2 12 1 (mod 13). So we first take out as many factors of 2 12 as possible. We can write 1000 as 83 12 + 4 (which is another way of saying that 1000 4 (mod 12). So 2 1000 = 2 12 83+4 = (2 12 ) 83 2 4 2 4 = 16 3 (mod 13).

What happens when the modulus isn t prime? What does the loop for 3 k mod 10 (last digit of 3 k ) look like?

What happens when the modulus isn t prime? What does the loop for 3 k mod 10 (last digit of 3 k ) look like? 3 9 7 1 3. This takes 4 steps to loop. In particular, after 10 1 = 9 steps we will not be back at 3.

What happens when the modulus isn t prime? What does the loop for 3 k mod 10 (last digit of 3 k ) look like? 3 9 7 1 3. This takes 4 steps to loop. In particular, after 10 1 = 9 steps we will not be back at 3. Why does this happen?

What happens when the modulus isn t prime? What does the loop for 3 k mod 10 (last digit of 3 k ) look like? 3 9 7 1 3. This takes 4 steps to loop. In particular, after 10 1 = 9 steps we will not be back at 3. Why does this happen? Powers of 3 can never be divisible by 2 and 5. So in addition to excluding the remainder 0, we also exclude 2, 4, 5, 6, and 8. The four remainders above are the only ones left.

Euler s Theorem Theorem If a and n have no common divisors, then a φ(n) 1 (mod n) where φ(n) is the number of integers in {1, 2,..., n} that have no common divisors with n. So to compute a b mod n, first find φ(n), then calculate c = b mod φ(n). Then all you need to do is compute a c mod n.

Wait, but how do we find φ(n)? Find φ(17): the number of integers in {1,..., 17} that have no common divisors with 17. Find φ(81). Find φ(100). Make a guess for what φ(n) looks like for as many different kinds of n as you can.

Answers φ(17) = 16 because none of the integers in {1,..., 17} except 17 itself have any common divisors with 17.

Answers φ(17) = 16 because none of the integers in {1,..., 17} except 17 itself have any common divisors with 17. φ(17) = 54: from the integers {1,..., 81} we exclude the ones divisible by 3, of which there are 27.

Answers φ(17) = 16 because none of the integers in {1,..., 17} except 17 itself have any common divisors with 17. φ(17) = 54: from the integers {1,..., 81} we exclude the ones divisible by 3, of which there are 27. φ(100) = 40. There are two ways to do this: There are 50 numbers in {1,..., 100} divisible by 2, which we discard. There are also 20 numbers divisible by 5, which we discard. But 10 numbers were divisible by 10, so we counted them twice. So φ(100) = 100 50 20 + 10 = 40. Of the numbers in {1,..., 100}, 1/2 are not divisible by 2, and 4/5 are not divisible by 5. So the number that aren t divisible by both is 1 /2 4/5 100 = 40.

General formula for φ(n) First we find a prime factorization of n: n = p a 1 1 pa 2 2 pa k k.

General formula for φ(n) First we find a prime factorization of n: n = p a 1 1 pa 2 2 pa k k. For small n, it s easier to do it this way: ) ) ) φ(n) = (1 (1 1p1 1p2 (1 1pk n.

General formula for φ(n) First we find a prime factorization of n: n = p a 1 1 pa 2 2 pa k k. For small n, it s easier to do it this way: ) ) ) φ(n) = (1 (1 1p1 1p2 (1 1pk n. Since (1 1 p1 ) p a 1 1 = pa 1 1 1 (p 1 1), we can write this as φ(n) = p a 1 1 1 (p 1 1) p a 2 1 2 (p 2 1) p a k 1 k (p k 1).

Euler s Theorem: Exercises Problem Find the last digit of 7 2013. Find the last two digits of 2 2013. Note that 2 and 100 do have a common factor!

Euler s Theorem: Exercises Problem Find the last digit of 7 2013. Find the last two digits of 2 2013. Note that 2 and 100 do have a common factor! Solution Since φ(10) = 4, to find 7 2013 mod 10 we find 2013 mod 4 = 1. So 7 2013 7 1 = 7 (mod 10).

Euler s Theorem: Exercises Problem Find the last digit of 7 2013. Find the last two digits of 2 2013. Note that 2 and 100 do have a common factor! Solution Since φ(10) = 4, to find 7 2013 mod 10 we find 2013 mod 4 = 1. So 7 2013 7 1 = 7 (mod 10). We can find 2 2013 mod 25: since φ(25) = 20, this is 2 13 17. This gives us 4 possibilities for 2 2012 mod 100: 17, 42, 67, 92. Of these, only 92 is possible the other three aren t divisible by 4.

The really hard problem.. 3 Now let s try to compute 3} 33. {{} mod 100. 2012 times

The really hard problem.. 3 Now let s try to compute 3} 33. {{} mod 100. 2012 times We ve seen φ(100) = 40. So we need to compute.. 3 } 3 33. {{} mod 40, and raise 3 to that power. 2011 times

The really hard problem.. 3 Now let s try to compute 3} 33. {{} mod 100. 2012 times We ve seen φ(100) = 40. So we need to compute.. 3 } 3 33. {{} mod 40, and raise 3 to that power. 2011 times We recurse to get φ(40) = 16, φ(16) = 8, φ(8) = 4, φ(4) = 2. In particular, 3 k 3 (mod 4) for any k.

The really hard problem.. 3 Now let s try to compute 3} 33. {{} mod 100. 2012 times We ve seen φ(100) = 40. So we need to compute.. 3 } 3 33. {{} mod 40, and raise 3 to that power. 2011 times We recurse to get φ(40) = 16, φ(16) = 8, φ(8) = 4, φ(4) = 2. In particular, 3 k 3 (mod 4) for any k. Working backwards, we get that 3 3... 3 is 3 3 3 mod 8, so it s 3 3 11 mod 16, so it s 3 11 27 mod 40, so it s 3 27 mod 100.

The really hard problem.. 3 Now let s try to compute 3} 33. {{} mod 100. 2012 times We ve seen φ(100) = 40. So we need to compute.. 3 } 3 33. {{} mod 40, and raise 3 to that power. 2011 times We recurse to get φ(40) = 16, φ(16) = 8, φ(8) = 4, φ(4) = 2. In particular, 3 k 3 (mod 4) for any k. Working backwards, we get that 3 3... 3 is 3 3 3 mod 8, so it s 3 3 11 mod 16, so it s 3 11 27 mod 40, so it s 3 27 mod 100. Handy trick: 3 27 = 3 3 26 = 3 (3 13 ) 2 = = 3 (3 (27 2 ) 2 ) 2. So we only need to do five multiplications mod 100, and we will end up getting 87.