How do I prove this division formula (decimal modular arithmetic)? I was doing some poking around by extending a math problem I got for homework. I found that if you have any number of only digits of 3, q = 33...3, the smallest number of all 1s, p = 11...1 such that p = 0*mod(q) has to be the number p = 11...1 with exactly 3 times as many 1s as the number q has 3s. 
How do I prove this, though?
 A: First prove:

The only multiples of the repunit $\underbrace{11\ldots1}_n$ that are themselves repunits are
  $$ \underbrace{11\ldots1}_{kn} = \underbrace{11\ldots 11}_n \times \underbrace {1\underbrace{0\ldots 0}_{n-1}1\underbrace{0\ldots 0}_{n-1}1\ldots\underbrace{0\ldots 0}_{n-1}1}_{k\text{ ones}}$$

This is relatively easily seen by noting that the last $n$ digits of the multiplier must be $00\ldots 01$ (since $11\ldots 1$ is invertible modulo $10^n$), and proceeding by induction.
Now since a multiple of $33\ldots3$ is in particular a multiple of $11\ldots1$, the number you're looking for must be $\underbrace{11\ldots 1}_{kn}$ for some integer $k$. Since the digital sum of the multiplier on the right above is $k$, the smallest $k$ for which $3$ divides the multiplier is $k=3$.
A: Note $\,\ \overbrace{(10^J\!-\!1)/3}^{\large 33\cdots 33}\,\mid\, \overbrace{(10^K\!-\!1)/9}^{\large 11\cdots 11}\iff 3 (10^J\!-\!1)\mid 10^K\!-\!1\,\Rightarrow\, J\mid K,\,$ say $\,K = nJ$
So with $\ a = 10^J\!-\!1\, $ above holds $\iff 3\ {\Large\mid}\, \dfrac{a^n-1}{a-1}\iff 3\mid n\ $ by $\ b=3\ $ below.
Lemma $\ $ If $\ b\mid \color{#c00}{a\!-\!1}\ $ then $\ b\ {\Large \mid}\ \dfrac{a^n-1}{a-1}\iff b\mid n$
Proof $\,\ {\rm mod}\ b\!:\,\ \color{#c00}{a\equiv 1}\ \Rightarrow\ \dfrac{a^n-1}{a-1} = \color{#c00}a^{n-1}\!+\cdots +\color{#c00}a+1\equiv \color{#c00}1^{n-1}+\cdots +\color{#c00} 1+1\equiv n$
