# Any digit written $6k$ times forms a number divisible by $13$

Any digit written $6k$ times (like $111111$, $222222222222222222222222$, etc.) forms a number divisible by $13$. (source: a solution taken from careerbless)

I tested with many numbers and it seems this is correct. But, is it possible to prove this mathematically? If so, it will be a convincing statement. Please help. I am not able to think how such properties can be proved.

• Hint: $22222222222...2222222222222=000001000001...000001000001\times2\times111111$. – user202729 May 8 '16 at 11:26
• I think the answer may follow from a 13-analogy of the "casting out nines" and "casting out 11's" test. – Jasper May 8 '16 at 11:26
• @user202729, but, this is a more generic statement, any digit written 6k times. That is why I am so confused about how to have a generic proof. – Kiran May 8 '16 at 11:29
• Oh I see that's even easier @user202729 ! – Jasper May 8 '16 at 11:29
• I just referred to "casting out 9" because you may be known to the proof of that. This is a bit like that. As user202729 and Noble Mushtak state, it's the best to decompose the number into products, then compute mod 13 to find that it's always zero due to a common factor 111111 – Jasper May 8 '16 at 11:33

1. Prove $111111$ is a multiple of $13$. (Hint: Use a calculator.)
2. Prove that all numbers with a digit written $6k$ times is a multiple of $111111$. You can do this by splitting a number up into groups of $6$ digits like this: $$222222222222222222=222222000000000000+222222000000+222222$$
Hint $\$ Casting $13$s: $\$ mod $13\!:\ \color{#c00}{10^3\equiv\, -1}\$ by $\, 10^3\equiv (-3)^3 \equiv -27\equiv -1$
Thus applying this to $\ 10^{3k}= (\color{#c00}{10^3})^k\equiv (\color{#c00}{-1})^k\$ we can cast $13$s in radix $10^3$
$$\begin{eqnarray} d_0& + \color{#c00}{10^3} &d_1 + \color{#c00}{10^6} &d_2+ \color{#c00}{10^9} &d_3 +\, \cdots\\ \equiv\ d_0&\color{#c00}-&d_1\ \ \ + &d_2\ \ \ \color{#c00}- &d_3 +\, \cdots \pmod{13}\end{eqnarray}$$
For example: $\ 222222111111 \,\equiv\, 111-111 + 222-222\,\equiv\, 0\pmod{13}$