Euler’s Theorem Evan Fang June 2, 2015 1 Introduction Euler’s Theorem is a useful concept that can be applied to many different types of number theory problems. This article more or less assumes the reader understands the basics of modular arithmetic. Basically, say we have 3 integers x, a, p. We see that x ≡ a (mod p) if x leaves a remainder of the form a − yp when divided by p where y is an integer. So 9 ≡ 3 (mod 6) but also 9 ≡ 9 (mod 6) as 9 leaves a remainder of 3 when divided by 6, which can also be written as 9 − 1(6). Similarly, 9 ≡ −3 (mod 6) and 9 ≡ 15 (mod 6). Math ”Vocab” used: 1. Relatively Prime Numbers: For two integers m and n, if gcd(m, n) = 1 then m and n are relatively prime. 2. a | b means a divides b. This is only true if there exists an integer k such that ka = b. 2 Euler Totient/Phi Function We start off this article by explaining what Euler’s totient, or the phi function is. First, I’ll give a few examples for you to try to guess what the function does. 1 1. φ(1) = 1 2. φ(2) = 1 3. φ(3) = 2 4. φ(4) = 2 5. φ(5) = 4 6. φ(10) = 4 7. φ(20) = 8 8. φ(32) = 16 Definition of Phi Function/Euler Totient Function If we have a positive integer n, then phi of n, (φ(n)), is a function that finds the number of positive integers less than or equal to n that are relatively prime to n. Another way to phrase this would be if n is a positive integer then φ(n) is the number of numbers in the set {1, 2, 3, · · · , n} that are relatively prime to n. So let’s take a look at the examples. We know φ(1) = 1 because in the set of {1} there is only one number that is relatively prime to 1, and that would be 1. We know φ(2) = 1 as in the set {1, 2} there is only 1 number that is relatively prime to 2, and that number is 1. Similarly φ(4) = 2 as in the set {1, 2, 3, 4} there are 2 numbers that are relatively prime to 4, which would be 1 and 3. Exercises 2.1 Exercise 2.1.1 Find the values of the following: 1. φ(6) 2. φ(7) 3. φ(12) 4. φ(61) 5. φ(73) Exercise 2.1.2 If p is a prime number, then what is the value of φ(p)? 2 Now, you might be wondering how to find φ(n) for larger positive integers n or if that’s even possible. As a matter of fact, it is. Let’s consider a perfect power of a prime first, that is to say pk where p is a prime number and k is a positive integer. Some examples would be 210 and 54 . Following that train of thought, what is φ(210 )? Well, the only prime factor of 210 is 2, so that means that the only numbers that could be relatively prime to 210 are those that contain no factors of 2. That would be half of the numbers. So φ(210 ) = 21 · 210 = 29 = 512. Now, let’s look at φ(54 ). Like last time, the only numbers that can be relatively prime to this are those that do not have a factor of 5. That would be (1 − 15 ) = 45 of the numbers. So the number of numbers relatively prime to 54 that are less than or equal to 54 would be φ(54 ) = 45 · 54 = 4 · 53 = 4 · 125 = 500 Now let’s take a look at a number with multiple prime factors, say 28 = 22 · 7. We know that (1 − 21 ) of the numbers less than 28 are relatively prime to 2 and that (1 − 71 ) of the numbers are relatively prime to 7. Thus, the fraction of numbers that are relatively prime to both 2 and 7 would be (1 − 12 )(1 − 17 ). It is easy to see that all the numbers that are relatively prime to both 2 and 7 must also be relatively prime to 28. This is because the only prime factors of 28 are 2 and 7, so all numbers relatively prime to both 2 and 7 would have no prime factors of 2 and 7, thus making them relatively prime to 28. Finally, we have that φ(28) = 28(1 − 21 )(1 − 71 ) = 28 ∗ 12 ∗ 6 7 = 12. To generalize, let n = pk11 pk22 · · · pkaa where all the ps in the sequence are prime numbers, all the ks are positive integers and a is a positive integer. Then, (1 − p11 ) of integers are relatively prime to p1 , (1 − p12 ) of integers are relatively prime to p2 , etc. so in total, (1 − p11 )(1 − p12 )...(1 − p1a ) integers are relatively prime to n. Thus, the number of numbers less than or equal to n relatively prime to n is simply n(1 − p11 )(1 − p12 )...(1 − p1a ). Formula for the phi function If n = pk11 pk22 · · · pkaa is a positive integer where p1 , p2 , · · · , pa represent the prime factors of n, then φ(n) = n(1 − p11 )(1 − p12 ) · · · (1 − p1a ) Another way to write this would be p1 − 1 p2 − 1 pk − 1 k1 k2 ka φ(n) = p1 p2 · · · pa ··· p1 p2 pk = (p1 − 1)(p2 − 1) · · · (pk − 1)pk11 −1 pk22 −1 · · · paka −1 . 3 Exercises 2.2 Exercise 2.2.1 1. φ(5) 2. φ(4) 3. φ(20) 4. φ(63) 5. φ(12) 6. φ(756) Exercise 2.2.2 Given 2 relatively prime positive integers a, b prove that φ(a)φ(b) = φ(ab) To end, here are some harder problems involving the phi function. Challenge Problems 2 Exercise Challenge 1(By AoPS user djmathman) Prove φ(N 2 ) = N ∗ φ(N ) . Exercise Challenge 2(By AoPS user djmathman) Prove φ(N 2 ) ≥ [φ(N )]2 . Exercise Challenge 3 Find the sum of all positive integers less than or equal to 180 that are relatively prime to 30. Exercise Challenge 4 Prove that for n ≥ 3 we have that φ(n) is even. Exercise Challenge 5 Find all positive integers n such that φ(n) = 4. 3 Euler’s Theorem It’s finally time to get back to the main theorem of this article. You may be wondering why I put all that mess about the phi function, but it was all in order to be able to more easily state Euler’s Theorem. Euler’s Theorem Statement For relatively prime positive integers a, n we have aφ(n) ≡ 1 (mod n). 4 Proof. Consider the set of distinct positive integers S = {n1 , n2 , · · · , nφ(n) } which are all relatively prime to n and less than or equal to n. Obviously, such a set must exist since there are φ(n) numbers less than or equal to n relatively prime to it (well, hopefully it’s obvious by now). Now, consider the set {an1 , an2 , · · · , anφ(n) }. We want to prove that all the numbers in this set are distinct mod n. Assume for 2 distinct integers k, j such that 1 ≤ k, j ≤ φ(n) we have ank ≡ anj (mod n). Since a and n are relatively prime, we have that this is the same as nk ≡ nj (mod n). But nk and nj are distinct positive integers less than n, which contradicts nk ≡ nj (mod n). Thus, an1 , an2 ...anφ(n) are all different mod n. Now, this implies that an1 an2 · · · anφ(n) ≡ n1 n2 · · · nφ(n) (mod n) as all the integers in the set an1 , ...anφ(n) are relatively prime to n and are distinct, which would have the same remainders when divided by n as n1 , n2 , ...nφ(n) . This proves Euler’s Theorem as we get aφ(n) (n1 n2 ..nφ (n)) ≡ n1 n2 · · · nφ(n) (mod n) or aφ(n) ≡ 1 (mod n) Now, let’s look at Fermat’s Little Theorem which states Fermat’s Little Theorem If p is a prime number and a is an integer such that a and p are relatively prime then ap−1 ≡ 1 (mod p). We can very easily prove this with Euler’s Theorem. Proof. aφ(p) ≡ 1 (mod p) from Euler’s Theorem. Since p is prime we know that φ(p) = p − 1. Thus ap−1 ≡ 1 (mod p). One easier example of when this comes in handy is when trying to determine the last 2 digits of a number. Example 1 Find the last 2 digits of 8943 . Proof. The last 2 digits of an integer is the remainder the integer has when divided by 100. So we are looking for 8943 (mod 100). By Euler’s Theorem we know that 89φ(100) = 8940 ≡ 1 (mod 100) This means that 8943 ≡ 8940 ∗ 893 ≡ 893 (mod 100). This means that 893 has the same last 2 digits as 8943 . By calculation, we see that 893 = 704969. So 8943 ends in 69. And of course, an example of a problem where the solution is a lot less obvious. 5 Example 2(AMSP NT2) Let p be a prime of the form 4k+3 for k ≥ 0, and let x and y be integers with p|x2 + y 2 . Then p|x and p|y. Proof. Note if p|x then x2 ≡ 0 (mod p). This means that if p|x then x2 +y 2 ≡ 0+y 2 ≡ y 2 ≡ 0 (mod p). This implies that p|y. Suppose p does not divide x or y. We have that x2 ≡ −y 2 (mod p). Also, from p = 4k + 3 we have p−1 = 2k + 1 which is an odd integer. So 2 p−1 p−1 (x2 ) 2 = xp−1 ≡ (−1)2k+1 (y 2 ) 2 (mod p). From Euler’s Theorem/Fermat’s Little Theorem xp−1 ≡ y p−1 ≡ 1 (mod p). This implies 1 ≡ −1 (mod p) which means p = 2, which is a contradiction as p is an odd prime. Thus, p|x and p|y. Now here are some challenge problems. Challenge Problems 2 1. Find 10 pairs of integers (x, y) such that a.) 2xy − 1 is divisible by 2x − 1 b.) The x and y values differ from pair to pair. (You are not allowed to use both the pairs (1, 1) and (1, 2) because they share the same x−value and similarly you cannot have both the pairs (1, 1) and (2, 1) because they share the same y − value. But you are allowed to have both the pairs (1, 2) and (2, 1)) 2. (AMSP NT2) Show that for each even positive integer n we have n2 − 1|2n! − 1. 3. (PuMAC) If f (x) = xx xx find the last 2 digits of f (17) + f (18) + f (19) + f (20). n 4. (AMSP NT2) Determine all primes p and integers n such that pn |7p + 1. 6