Now mod this!

Find the remainder of 3 + 33 + 333 + 3333 + + 333 3 2019 digits 3 + 33 + 333 + 3333 + \cdots + \underbrace{333 \dots 3}_{2019 \text{ digits}} divided by 673 673 .

Hint: 673 673 is a prime number.


The answer is 370.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Mark Hennings
Oct 23, 2019

We are interested in the number X = n = 1 2019 1 0 n 1 3 = 10 27 ( 1 0 2019 1 ) 673 X \; = \; \sum_{n=1}^{2019} \frac{10^n-1}{3} \; = \; \tfrac{10}{27}\big(10^{2019} - 1\big) - 673 Now 1 0 672 1 ( m o d 673 ) 10^{672} \equiv 1 \pmod{673} , so 1 0 2019 1 0 3 × 673 1 0 3 ( m o d 673 ) 10^{2019} \equiv 10^{3 \times 673} \equiv 10^3 \pmod{673} , so 1 0 2019 1 999 = 27 × 37 ( m o d 673 ) 10^{2019} - 1 \equiv 999 = 27 \times 37 \pmod{673} , and hence X 10 27 ( 1 0 2019 1 ) 10 × 37 370 ( m o d 673 ) X \equiv \tfrac{10}{27}\big(10^{2019} - 1\big) \equiv 10 \times 37 \equiv \boxed{370} \pmod{673}

Nice and clean! I didn’t notice that 999 = 27 37 999 = 27 \cdot 37 which saves some hustles of finding modular inverse! Thanks!

Vens L. - 1 year, 7 months ago
Vens L.
Oct 24, 2019

We split this problem into two parts: (I) find a closed form expression of the given sum; (II) mod it by 673 673 .

Part I: Find a closed form expression of the sum

For all positive integer n n , define a n = 333 3 n digits , a_n = \underbrace{333 \dots 3}_{n \text{ digits}}, and the partial sum of sequence ( a n ) (a_n) S n : = a 1 + a 2 + a 3 + + a n : = 3 + 33 + 333 + + 333 3. \begin{aligned} S_n &:= a_1 + a_2 + a_3 + \cdots + a_n \\[0.5em] &\phantom{:}= 3 + 33 + 333 + \cdots + 333 \! \dots \! 3 . \end{aligned} The key is to observe that 3 a k + 1 = 1 0 k , for all k 1 , 3a_k + 1 = 10^k, \quad \text{ for all } k \ge 1, and sum this identity over k = 1 , 2 , 3 , , n k = 1, 2, 3, \dots, n to get 3 S n + n = k = 1 n 1 0 k = 10 9 ( 1 0 n 1 ) geometric series , 3S_n + n = \underbrace{\sum_{k=1}^{n} 10^k = \frac{10}{9}(10^n - 1)}_{\text{geometric series}}, which means, S n = 10 27 ( 1 0 n 1 ) n 3 . {\color{darkred} S_n = \frac{10}{27}(10^n - 1) - \frac{n}{3}}.

Part II: Mod the desired sum by 673 673

Now we proceed to find the remainder of S 2019 S_{2019} divided by p = 673 p = 673 .

Firstly, by the Euclidean algorithm together with Bézout’s lemma , we can find the modular inverse of 27 27 modulo p p to be 349 \color{#0C6AC7} 349 .

Specifically, 1 = gcd ( 27 , 673 ) = 349 27 14 673 p 349 27 ( m o d p ) , 1 = \text{gcd}(27, 673) = {\color{#0C6AC7} 349} \cdot 27 - 14 \cdot \underbrace{673}_{p} \equiv {\color{#0C6AC7} 349} \cdot 27 \pmod{p}, or put simply, 2 7 1 349 ( m o d p ) . 27^{-1} \equiv {\color{#0C6AC7}349} \pmod{p}. Hence, S 2019 = 10 27 ( 1 0 2019 1 ) 2019 3 = 10 2 7 1 ( 1 0 2019 1 ) 673 10 349 ( 1 0 2019 1 ) 125 ( 1 0 2019 1 ) ( m o d p ) . \begin{aligned} S_{2019} &= \frac{10}{27} (10^{2019} - 1) - \frac{2019}{3} \\[0.7em] &= 10 \cdot 27^{-1} \cdot (10^{2019} - 1) - 673 \\[0.7em] &\equiv 10 \cdot {\color{#0C6AC7}349} \cdot (10^{2019} - 1) \\[0.7em] &\equiv 125 \cdot (10^{2019} - 1) \pmod{p}. \end{aligned} Finally, we tackle the term 1 0 2019 1 10^{2019} - 1 modulo p p with the aide of Fermat’s little theorem : 1 0 p 10 ( m o d p ) , 10^{p} \equiv 10 \pmod{p}, or, as 2019 = 3 p 2019 = 3p , 1 0 2019 1 = ( 1 0 p ) 3 1 1 0 3 1 = 999 326 ( m o d p ) . 10^{2019} - 1 = (10^p)^3 - 1 \equiv 10^3 - 1 = 999 \equiv 326 \pmod{p}. Therefore, the desired value is S 2019 125 326 = 40750 370 ( m o d p ) . S_{2019} \equiv 125 \cdot 326 = 40750 \equiv \boxed{\mathbf{370}} \pmod{p}. And this conclude the solution.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...