# If $n$ is an integer not divisible by 2 or 5 then prove …

If $n$ is an integer not divisible by 2 or 5 then prove that there is a multiple of $n$ consisting of ones only.

I had proved this for primes using Fermat's theorem. But I can't prove it for composite numbers. Any help will be appreciated.

• Hint: start with $a$ such that $10^a\equiv 1 \; mod(n)$ – lulu Oct 3 '15 at 15:08
• For composites, use Euler's theorem. – Dylan Oct 3 '15 at 15:08

Consider the remainders when $10^1$, $10^2$, $10^3$, and so on are divided by $9|n|$. By the Pigeonhole Principle, there exist natural numbers $i$ and $j$ such that $i\lt j$ and $10^i$ and $10^j$ have the same remainder on division by $9|n|$.
It follows that $9|n|$ divides $10^{i}(10^{j-i}-1)$. Since $10^i$ and $9|n|$ are relatively prime, we conclude that $9|n|$ divides $10^{j-i}-1$.