About the fact that every natural number which is coprime to $10$ has a multiple in the form that each digit is $1$.

It is known that every natural number which is coprime to $10$ has a multiple in the form that each digit is $1$.

For example, we can see $$111=3\times 37, 111111=7\times 15873, 111111111=9\times 12345679,$$$$11=11\times 1, 111111=13\times 8547,\cdots$$

To prove the above fact is easy if we use Pigeonhole principle.

Then, here is my question.

Question : How can we get the minimum digit (let this be $N(m)$) of multiples of $m$ in the above form for any $m\in\mathbb N$ which is coprime to $10$?

(I think the best answer would be to represent $N(m)$ by $m$ if it is possible.)

For example, though we get $111111111111=13\times 8547008547$, we know that $N(13)=6.$

Motivation : The above fact got me interested in this question.

-
I would not expect a simple answer. The order of $10$ modulo $m$, even in the simple case $m$ prime, is quite irregular. – André Nicolas Oct 3 '13 at 4:04
@AndréNicolas : I agree with you. But that's why I'm asking the people here to get some hints. – mathlove Oct 3 '13 at 6:59

The easiest way to get the minimum digit is to evaluate $\frac1m$, and find the number of digits within the repeating part of the number (unless $m$ is a multiple of 3, in which case you have to make some corrections).

So, for instance, to get a repunit (the general term for numbers of the form $111...111$) from $7$, you have to multiply by 15873 to get 111111. That's N(7)=6. Similarly, if you evaluate $\frac17$, you get

$$\frac17 = 0.\overline{142857}$$ Six digits for the repeating part of the decimal expansion.

This works because you have $$\frac{999999}7 = 142857$$ And thus $$\frac{111111}7 = \frac{142857}9 = 15873$$ Where $m$ is divisible by 3, you must multiply the resulting number of digits by 3, and similarly, if $m$ is divisible by 9, you must multiply by 9. You do not need to do this for higher powers of 3 beyond this - for instance, for $m=27$, you have $$\frac1{27} = 0.\overline{037}$$ and thus you get 3, but you only need 27 digits, so you only have to multiply by 9.

-
Thanks for your answer. I think your idea is nice though I'm not sure that I can understand your idea completely. Then, the problem to know digis for the repeating part of the decimal expasion for any $\frac 1m$ still remains unsolved, right? I think this is another big problem, though. – mathlove Oct 3 '13 at 6:57
No, there's a way to determine the number directly. Here's a hint: $999...999 = 10^n-1$. So you're looking for an $n$ for which $10^n-1 \equiv 0 \pmod m$. – Glen O Oct 3 '13 at 12:51
There's no closed-form answer. The "work out the length of the repeating part of the inverse" is just the easiest way to see what's going on. – Glen O Oct 3 '13 at 12:53
Oh, I see. So, we can find what we want in your way. Thanks. – mathlove Oct 3 '13 at 14:32