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 MM, MNM \in \mathbb{N} . The sequence's ratio=10ratio = 10, and U1=1U_1 = 1. Then we can get the sum mod MM from ((10n1)/9)modM((10^n -1)/9) \: mod \: M. But, for large nn, the formula isn't efficient. So I do searching. I got a better formula: (10nmod  (9×M)1)/9(10^n \: mod \: \: (9 \times M) \: -1)/9
In the end, I got accepted by both formulas. But I can't prove why ((10n1)/9)modM=(10nmod  (9×M)1)/9((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

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

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