The fundamental theorem of arithmetic states that any positive integer N can be uniquely factorized into the form N=p1q1p2q2…pnqn, where pi are distinct primes, and qi are positive integers. How many integers 1≤k≤N are there such that gcd(k,N)=1? This seems difficult to count directly, so instead, consider the integers 1≤k≤N such that gcd(k,N)=1 (k are the integers divisible by pi for some i). Of the integers less than N, p1N of them are multiples of p1. Similarly, p2N of the integers less than N are multiples of p2. However, we have included multiples of p1p2 in both of these sets, thereby double counting.
The Principle of Inclusion and Exclusion (PIE) is a method to count the number of elements in overlapping sets. For i=1 to n, let Pi be the set of integers smaller than or equal to N that are multiples of pi. Then the number of integers that are multiples of pi is ∣Pi∣=piN. The number of integers that are multiples of pipj is ∣Pi∩Pj∣=pipjN. This holds true in general: for any subset S of {1,2,…,n}, the number of integers that are multiples of s∈S∏ps is ∣⋂s∈SPs∣=∏s∈SpsN.
Then, the set of numbers that satisfy gcd(k,N)=1 is exactly the set of numbers that are not a multiple of any pi, hence are not in any of the sets Pi. By the Principle of Inclusion and Exclusion,
N−∣∣i⋃Pi∣∣===N−i∑∣∣Pi∣∣+i=j∑∣∣Pi∩Pj∣∣−i=j,j=k,k=i∑∣∣Pi∩Pj∩Pk∣∣+…+(−1)n∣∣i⋂Pi∣∣N−i∑piN+i=j∑pipjN−i=j,j=k,k=i∑pipjpkN+…+(−1)n∏ipiNN(1−p11)(1−p21)(1−p31)…(1−pn1)
The number of integers smaller than N that are coprime to N is Euler's phi function ϕ(N).
Euler's Theorem: If gcd(a,N)=1, then aϕ(N)≡1(modN).
Proof: Let S be the set of integers that are coprime to N. Let aS be the set of (possibly repeated) integers of the form {as:s∈S} taken modulo N. First, we show that there are no repeats. If there are repeats, i.e., asi≡asj(modN), then Modulo Arithmetic Property H implies si≡sj(modN). But since every element s in S is smaller than N, this is not possible. Second, we show that aS is contained within S. This is true because given s an element of S, 1≤gcd(as,N)≤gcd(a,N)×gcd(s,N)=1×1=1, so gcd(as,N)=1 which shows that as is an element of S. Since aS is a set of ϕ(N) distinct elements contained in S, which is also a set of ϕ(N) distinct elements, it follows that these sets are the same modulo N.
Since the sets contain the exact same elements modulo N, the product of all the elements of aS is equal to the product of all the elements of S modulo N. Therefore,
as1⋅as2⋅…⋅asϕ(N)≡s1⋅s2⋅…⋅sϕ(N)(modN).
Since s1⋅s2⋅…⋅sϕ(N) is coprime to N, it follows from Modulo Arithmetic Property H that aϕ(N)≡1(modN).
Note: The set S is also called a reduced residue system modulo N.
Worked Examples
1. What is the units digit of 9753?
Solution: Finding the units digit of a number is equivalent to working modulo 10. By Euler's theorem, we need only determine the value of the exponent 753 modulo ϕ(10)=10×(1−21)×(1−51)=4. Again by Euler's theorem, we need only determine the value of the exponent 53 modulo ϕ(4)=4×(1−21)=2. Then
537539753≡≡≡137193≡≡≡131≡3729≡9(mod2)(mod4)(mod10)
Note: Another approach is to realize that 9n(mod10) is the sequence 9,1,9,1,9,1,… which has period 2. Since the parity of the exponent is odd, this implies the last digit is 9.
2. Calculate (by hand) the value of 215.
Solution: By Euler's theorem, ϕ(21)=21×(1−31)(1−71)=12, implying 1012≡1(mod21). In fact, we can do better than this by applying Euler's theorem to ϕ(3)=3×(1−31)=2 and ϕ(7)=7×(1−71)=6. We know that 106≡(102)3≡13≡1(mod3) and 106≡1(mod7), thus 106≡1(mod21). In particular, 106−1=21×47619. Hence,
215=21×476195×47619=999999238095=0.238095238095......
3. [Fermat's Little Theorem] If p is a prime and a is an integer, show that ap≡a(modp).
Solution: Observe that if p is a prime, then ϕ(p)=p×(1−p1)=p−1. Hence, by Euler's Theorem, if gcd(a,p)=1, then
ap−1≡1(modp)⇒ap≡a(modp).
What about the values of a such that gcd(a,p)=1? In this case, a will be a multiple of p, so ap≡0p≡0≡a(modp).
Note: This can also be shown by induction on a.
4. Show that if n is an odd integer, then n divides 2n!−1.
Solution: By Euler's Theorem, n divides 2ϕ(n)−1. Since ϕ(n)<n, we have n!=ϕ(n)⋅k for some integer k. Since
2n!−1=(2ϕ(n)−1)(2ϕ(n)⋅(k−1)+2ϕ(n)⋅(k−2)+…+1),
it follows that n also divides 2n!−1.
#NumberTheory
#Euler'sTheorem
#KeyTechniques
#Olympiad
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i-1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
Researches on set notation
Cool! :D
Nice one but couldn't understood everything stated above.
Log in to reply
which part do u need help with?
Log in to reply
The third point in worked examples i.e. Fermat's little theorem.
can you explain the euler phi function @Mardokay Mosazghi
Log in to reply
Yea I think the first part could be explained without the use of the inclusion exclusion principle
wow....interesting facts
Really interesting but one thing I wasn't clear about is that the the phi function of 3 (say) gives the number of integers less the 3 that are coprime to 3 so isn't only 2 the integer that satisfies this property. So the function would give 1 as the output and not 2 as in one of the worked examples?
Log in to reply
The number 1 is coprime to every integer, since gcd(1,n)=1.
IN particular, ϕ(p)=p−1 for all primes p.
Log in to reply
Thanks!
Is there a wiki? If not, you should add it to wiki. Thanks.
I didn't understand the worked example 1. Why do you use Euler's theorem there?
Log in to reply
I'm guessing what you mean is "Why use Euler's Theorem, when there is a better approach by pattern recognition?". If so, read the rest of the comment. If not, please clarify further.
There can be multiple ways of solving a problem. In this particular instance, being able to recognize the pattern directly might seem more efficient. However, in the generalized format, Euler's Theorem would have to be used. E.g. What are the last 3 digits of 753?
Log in to reply
No, I didn't understand how you use the theorem there. (Euler's function is just the number of coprime integers lesser than n). How is this related to the usage in this problem?
Log in to reply
gcd(a,N)=1, then aϕ(N)≡1(modN)?
Are you aware that Euler's theorem states that " IfSince we want to find the last digit, that is equivalent to calculating (mod10), so we set N=10 and calculate that ϕ(10)=21×54×10=4.
We have a base of 9, so we set a=9.
Thus, we know that 9ϕ(10)=94≡1(mod10).
Now, we just need to investigate the power, which is 753.
We know that 94≡1(mod10), so we need to know how many 4's there are in 753.
What is 753(mod4)?
(Ideally, use Euler's Theorem to practice it, though there are many ways that we could solve this.)
Log in to reply
Log in to reply
ϕ(10)=4,ϕ(4)=2. I've edited my comment to make that obvious.
It is because of(I'm not quite sure how 5-1=4, 3-1=2 come in, and that's most likely on the wrong track, but I won't know for certain unless I see other work.)
Helpful! :-)
Nice :)