# Length of smallest repunits divisible by primes

I want to prove this statement from Wikipedia:

It was found very early on that for any prime p greater than 5, the period of the decimal expansion of 1/p is equal to the length of the smallest repunit number that is divisible by p.

For example, $\cfrac{1}{7}=0.(142857)$, so the period is $6$. And indeed, $\cfrac{R(6)}{7}=15873$, so it seems to be true for at least some primes. But how is this proven for all primes?
My idea was to say (for $p=7$): \begin{align} \cfrac{R(6)}{7} & = \cfrac{111111}{7}\\ & =\cfrac{10^7-1}{9\cdot7}\tag{p is coprime to 9} \\ &\implies 7|10^6-1 \end{align} In general (p>10), this might lead to: \begin{align} \cfrac{R(k)}{p} & = n\tag{n is some integer} \\ &\implies p|10^{k}-1 \end{align} So we would have to proof that $p|10^k-1$, where $k$ is the period of $^1/_p$. Is this the right way to prove the statement? If yes, how would I continue, if no, where should I look for a solution? Please just give a hint.

Edit: thanks to lab bhattacharjee, another way of putting it is: prove that $\text{ord}_p(10)$ is equal to the period of $^1/_p$.

-
This can be generalized for integer $n$ with $(30,n)=1$ If $\displaystyle n|\underbrace{11\cdots11}_{m\text{ digits}}\iff n|\underbrace{9\cdots99}_{m\text{ digits}}=(10^m-1)$ Now, the smallest positive value of $m=$ord$_n(10)$ – lab bhattacharjee Jul 29 '14 at 13:02
@Pim Did you notice what $15873\cdot9$ is? Try to draw a connection (in general) between the terms of a repeating decimal and the corresponding fraction. – Erick Wong Jul 29 '14 at 14:47

Thanks Erick Wong, I understand it now. So we need $p|10^k-1$, so $$\cfrac{10^k-1}{p}=\cfrac{10^k}{p}-\cfrac{1}{p}=n$$ So we need the fractional parts of $\cfrac{10^k}{p} \text{and}\cfrac{1}{p}$ to be equal: that will happen for the first time if $k=\text{period}_\frac1p$: For example, $$\cfrac{1}{13}=0.(076923) , 10^6\cdot\cfrac{1}{13}=76923.(076923)$$ And the difference is $76923$