[Math] Find the remainder when $123412341234$…(written $1234$ times) is divided by $13$

elementary-number-theorymodular arithmetic

Find the remainder when $123412341234$…(written $1234$ times) is divided by $13$

I divided $1234$ by $13$ and I got the answer $12$ which is the correct answer but what is the approach behind solving this one?

Best Answer

$\underbrace{1234}_{\text{written } 1234\text{times}}\cdots=1234\sum_{r=0}^{1233}(10^3)^r$

Now $S=\sum_{r=0}^{1233}(10^3)^r=\dfrac{10^{3\cdot1234}-1}{10^3-1}$

Now $10^3\equiv-1\pmod{13}\implies10^{3\cdot1234}\equiv(-1)^{1234}\equiv1$

As $(10^3-1,13)=1,13|S$