Why is every prime except 2 and 5 a divisor of some 99...99?

100 Views Asked by At

I already know one answer to the question (which is why the question occurred to me). Here it is:

If $p$ is a prime not equal to $2$ or $5$, then $\frac1p$ has a repeating decimal expression: $$0.d_1d_2\cdots d_k\overline{e_1e_2\cdots e_\ell}$$ where the $d$'s and the $e$'s are digits. Standard techniques (e.g. geometric series) show that $$\frac1p=\frac{d_1d_2\cdots d_k}{10^k}+\frac{e_1e_2\cdots e_\ell}{10^k(10^\ell-1)}=\frac{d_1d_2\cdots d_k\cdot(10^\ell-1)+e_1e_2\cdots e_\ell}{10^k(10^\ell-1)}$$ (Here $d_1d_2\cdots d_k$ and $e_1e_2\cdots e_\ell$ are not products but decimal expansions of integers.)

We can reduce this complicated fraction to $\frac1p$, so the denominator is a multiple of $p$. But $p$ isn't $2$ or $5$, so $10^\ell-1$ is a multiple of $p$.

I have not thought about number theory much, but I imagine this follows from some standard undergraduate number-theorem. Does anyone know one? And does anyone know the history of the proof above? Surely, lots of people teaching Calculus (like me, right now) have noticed this in the course of making tests. Or have I made some mistake?

2

There are 2 best solutions below

1
On

Your title is actually backwards, what you showed is that there exists $\ell$ such that $p\mid 10^\ell -1$ when $p\ne 2,5$. This is $10^\ell-1$ being divisible by the prime not the prime being divisible by $10^\ell-1$.

Nonetheless, this is true, and you gave an interesting argument for it. In general, this follows from a result known as Fermat's little theorem, which says that if $p\nmid a$, then $p\mid a^{p-1}-1$.

Note on notation: $a\mid b$ is read as $a$ divides $b$ and means that $\frac{b}{a}$ is an integer.

I can't say I'm familiar with the proof you gave or its history though.

7
On

You can go a little further.

Theorem 1: For any number, prime or not, $k$ then if $m=\gcd(k,10)$ then there is $99999....9999= 10^l$ so that $m$ divides into $10^l -1$

Pf: You gave it. Well, for a full proof we have to prove all decimals of rational numbers repeat infinitely. That's easy to show as there are only $m$ possible remainders and once a remainder comes up the second time you are in an infinite loop to repeat yourself.

Corrolaries: If $\gcd(k, 3) = 1$ then there is a $111111.....l$ that $m$ divides into. If $\gcd(k,9) = 3$ then there is a $333333.....3$ that $m$ divides into.

But here's a powerful second theorem.

Th 2: If $p$ is a prime, then $p$ divides into $\frac {10^{p-1}-1}9= \underbrace{1111....111}_{p-1\text{ times}}$.

This is a direct result of Fermat's Little theorem that for any prime $p$ and and any $a;\gcd(a,p)=1$ that $a^{p-1} \equiv 1 \pmod p$ or in other words that $p$ divides into $a^{p-1}$.

I'm not going to prove FLT but, now that I think of it, it's a rather sophisticated variation of your argument.