Find the remainder when $ 528528528...$up to $528$ digits is divided by $27$? Find the remainder when $528528528...$up to $528$ digits is divided by $27$?
Here's what I have done: The number can be written as $528\cdot 10^{525}+528\cdot 10^{522}+...+528$ which has $176$ terms and each term is $\equiv15 \mod 27$ thus the number should be $176*15 \mod 27$ hence $21$ should be the remainder. But book says it is $6$. I don't understand the flaw in my logic. Please correct me.
 A: Here is a python3 session
>>> s = '528' * 176
>>> len(s)
528
>>> int(s) % 27
21

A: You can see that $6$ cannot be correct by casting out $9$'s: Since $5+2+8=5+5+5$, we have
$$528528\ldots528\equiv5+5+5+\cdots+5+5+5=5\cdot528\equiv5(5+2+8)\equiv5\cdot6\equiv3\mod 9$$
so the remainder mod $27$ must be either $3$, $12$, or $21$. Your approach gave the correct answer, $21$.
A: Since $3\mid111$, we know that $27\mid999$, Therefore,
$$
1000\equiv1\pmod{27}
$$
Thus,
$$
\begin{align}
\sum_{k=0}^{175}528\cdot1000^k
&\equiv528\cdot176\pmod{27}\\
&\equiv3\cdot176^2\pmod{27}\\
&\equiv3\cdot14^2\pmod{27}\\
&\equiv3\cdot7\pmod{27}\\
&\equiv21\pmod{27}
\end{align}
$$
A: You are incorrect in assuming $10^{k} \equiv 1 \mod 27$.  As $10^k \not \equiv 1$ we do not have $528*10^k \equiv 15 \mod 27$.
What you need instead is $528528... = 528(1001001001......)$
And $1001001..... =\sum_{k=0}^{175} 10^{3k}$
$10^3 \equiv 1 \mod 27$... Oh... we do have that and you were not wronng after all.... so $\sum 10^{3k}\equiv 176 \equiv 14 \mod 27$.
So $528528....... \equiv 15*14 \equiv 21 \mod 27$.
And... the book is wrong. 
Had it been 527 iterations of 528 the answer would be $6$.
A: Note that $27 \times 37 = 999$. 
To find the remainder you get when you divide $528528\cdots 528$ by $999$, you can "cast out" $999$s.
$\underbrace{528 + 528 + \cdots 528}_{\text{$176$ times} } \to 176 \times 528 \to 92928 \to 92+928 \to 1020 \to 21$
So the remainder is $21$.
Note. If the remainder was bigger than 26, you would have had to divide it by 27 to get the correct remainder.
