From Repeating Decimal to Euler's Theorem
This is a study note for the Euler’s Theorem. Starts with a video of @TchLiyongle.
A Primary Problem to Repeating Decimal
The Problem
The video starts with a problem:
If a decimal integer number end with digit
m. And if we move thismto the front of the number, the new number isntimes of the original number. What is the smallest original number?
For example m = 4, n = 4, the smallest number is 102564.
We can use equations or vertical multiplication(which I used) to solve the problem for given m and n. But the video gives a more general solution.
A General Solution with Repeating Decimal
The video gives a general solution using the construction of a repeating decimal. Let’s note the original number as x, and the number of digits of x as r. We have:
Hence:
\[y = \frac{m}{10n - 1}\]And x is the shortest repeating decimal of y, which is the $\overline{a_1a_2a_3…a_{r-1}m}$ part.
Here we have
10n - 1in the divisor, soyis a pure repeating decimal, not a mixed decimal(which have leading zeros not repeated in following repeats, like1/700 = 0.00142857142857..). Because mixed repeating decimal only happens when divisor have factor of2or5.
But the
ywith leading zeros still does not valid, likem = 1, n = 100,y = 0.001001...is not valid.x = 001is not a valid integer in most cases.
Multiplicative Order and Primitive Root
A Leftover Problem
The video gives another problem in the end:
How to know the length
rof the repeating decimal of1/q?
For
p/qwe can getrthen calculate the range of length based on the length ofp. So we here only consider1/q.
To understand the problem, we need to rephrase the problem in a more formal way:
\[\frac{1}{q} = 0.\overline{a_1a_2a_3...a_ra1...}\]is equivalent to:
\[\frac{10^r}{q} = \overline{a_1a_2a_3...a_r}.\overline{a_1...}\] \[\frac{10^r - 1}{q} = \overline{a_1a_2a_3...a_r}\]We need to find the smallest r that makes 10^r - 1 a multiple of q. This also means \(\overline{a_1a_2a_3...a_r}\) is the smallest k that satisfies q * k + 1 = 10^r. So we have to find the smallest r that:
Multiplicative Order
Such r is called the order of 10 modulo q. And the smallest r is called the multiplicative order of 10 modulo q.
In number theory, given a positive integer
nand an integeracoprime ton, the multiplicative order ofamodulonis the smallest positive integerksuch thata^k ≡ 1 (mod n)–Wikipedia
The relationship between a and n can related to the primitive root.
When gcd(a, n) != 1, we can divide both sides by gcd(a, n) to get a new equation with gcd(a, n) = 1. So we can assume gcd(a, n) = 1. This is similar to the case where
p/qandq != 1.
Primitive Root
In modular arithmetic, a number
gis a primitive root modulo n if every numberacoprime tonis congruent to a power ofgmodulon. That is, g is a primitive root modulonif for every integeracoprime ton, there is some integerkfor whichg^k ≡ a (mod n). Such a valuekis called the index or discrete logarithm of a to the basegmodulon. Sogis a primitive root modulo n if and only ifgis a generator of the multiplicative group of integers modulo n. –Wikipedia
中文的解释:原根。建立在a模n的阶的概念上。如果a模n的阶k是欧拉函数φ(n)的话,那么这个数a就是n的原根。因为这说明a^1, a^2, a^3, …, a^k mod n是一个完全剩余系(余数都不同, 且个数为所有小于n与n互质的数的个数)这就回归到了英文版的定义。
It’s kind of hard to fully understand the definition. Let’s break it down:
nis the divisor in mod operation. It’s the start of the problem. Usually, we need to find aprimitive rootof it. In our case,n = q.gis the base in mod operation. And thegis the answer to the problem, theprimitive root. In our case,g = 10.ais an arbitrary number that is coprime ton. We need to check if there is akthat can help us to getg^k ≡ a (mod n). It’s the condition that thegneeds to satisfy.kis the power ofn. If there is akto getaas remainder, thengis theprimitive rootofn.
So we say g is a primitive root modulo n if for every integer a coprime to n, there is some integer k for which g^k ≡ a (mod n). Which is given n > 1 and g:
Now, let’s introduce Euler's Function and Euler's Theorem to help us solve the problem.
Euler’s Work
Euler’s Function
In number theory, Euler’s totient function counts the positive integers up to a given integer n that are relatively prime to n. It is written using the Greek letter phi as φ(n) or ϕ(n), and may also be called Euler’s phi function. –Wikipedia
For $n=p_1^{k_1} p_2^{k_2} \cdots p_r^{k_r}$, the value is:
\[\varphi(n) =n \prod_{p\mid n} \left(1-\frac{1}{p}\right)\]An equivalent formulation is:
\[\varphi(n) = n \left(1 - \frac{1}{p_1}\right)\left(1 - \frac{1}{p_2}\right) \cdots \left(1 - \frac{1}{p_r}\right)\]The formula means subtracting the number that have gcd with n = p1, p2, …etc.