How to proof this formula

Akmal06

New member
Joined
May 4, 2020
Messages
5
Yesterday, I faced a problem that required me to count the sum of a geometric sequence modulo \(M\), \(M \in \mathbb{N} \). The sequence's \(ratio = 10\), and \(U_1 = 1\). Then we can get the sum mod \(M\) from \[((10^n -1)/9) \: mod \: M\]. But, for large \(n\), the formula isn't efficient. So I do searching. I got a better formula: \[(10^n \: mod \: \: (9 \times M) \: -1)/9\]
In the end, I got accepted by both formulas. But I can't prove why \[((10^n -1)/9) \: mod \: M \: = \: (10^n \: mod \: \: (9 \times M) \: -1)/9 \]
Please help me to prove it. Thank you.

*Sorry for my bad English, since English is not my first language.
 
Please double check these steps, since I'm not completely sure

[math]\left( \frac{10^n-1}{9} \right) \bmod M[/math]
[math] = \left( \left( 10^n-1 \right) \bmod (9M) \right) / 9[/math]
[math] = \left( \left( \left(10^n \bmod (9M)\right) -1 \right) \bmod (9M) \right) / 9[/math]
Because \( 10^n \bmod (9M) \) can never be 0, the outer "mod" can safely be removed

[math] = \left( \left(10^n \bmod (9M)\right) -1 \right) / 9[/math]
 
Top