2 Answers
2

When one writes an irreducible fraction $m/n$ as a periodic digit number all one does is to write

$m/n=\frac{a}{999...9000.00}$

So the number of digits before the period is the maximum of the power of $2$ and $5$ in $n$,
i.e. wirting $n=2^\alpha 5^\beta k$ with $k$ relatively prime to $10$, the number of digits before the
period is $\max\{\alpha, \beta \}$.

I think that this will follow for free from the following lemma, whose proof is trivial:

Lemma: if gcd$(k,10) =1$ then $k$ has a multiple of the form $999...9$.

So stated another way, the number of non-repeating decimals is equal to the number of times the denominator is divisible by either 5 or 2. For example, 1/12, 12 is divisible by 2, 2 times, and there are 2 non-repeating digits. 1/96, 96 is divisible by 2 - 5 times... Do you recommend a good number theory book that explains this in more depth? Thank you Nick!
–
user9934Oct 11 '10 at 3:28

Suppose we deal with base $B\in\mathbb{Z}$. The trick is to consider the distinct primes that divide $B$. If $a/b$ is in lowest terms, then the prime factorization of $b$ can be sorted into primes that divide $B$ and primes that don't. If $b=uv$, where every prime dividing $u$ divides $B$ and no prime dividing $v$ divides $B$, then $u\mid B^n$ for some integer $n$, and $(v, B)=1$. Then in base $B$, the expansion of $a/b$ satisfies the following:
(a) The smallest integer $n$ such that $u\mid B^n$ is the number of non-repeating digits that precede the periodic repeating portion;
(b) The order of $B$ (mod $v$) - it exists since $(v,B)=1$ and theoretically divides $\phi(v)$ - is the length of the periodic repeating portion.

The special case where $B=10$ is what is usually used. In that case, the distinct primes dividing $B$ are $2$ and $5$. Thus $u=2^\alpha 5^\beta$ and the smallest $n$ such that $u\mid 10^n$ would be $\max\{\alpha,\beta\}$. So Nick S was right.