# How do you calculate/prove the length of n, the number of non-repeating digits preceeding a periodic sequence of a fractional repeating decimal [closed]

Is there a way to calculate the number of non-repeating digits that precede the periodic repeating portion of a decimal expansion? For example:

1/6 = 0.1666.... (there is 1 non repeating digit) **(Correction) 1/12 = 0.08333... (there are 2 non repeating digits) 7/12 = 0.58333....(there are 2 non repeating digits) 1/96 = 0.01041666..(there are 5 non repeating digits)

Do any forumulas exist for predicting the maximum length n, of the number of non repeating digits preceding the repeating portion?

I know that if the denominator of a fraction is n, the maximum length of the repeating periodic portion is n-1. Must also the length of the preceding portion before the cycle be n-1?

Thank you!

-

## closed as off-topic by Qiaochu Yuan, Daniel Loughran, Yemon Choi, Stefan Kohl, Felipe VolochDec 2 '14 at 10:34

This question appears to be off-topic. The users who voted to close gave these specific reasons:

• "This question does not appear to be about research level mathematics within the scope defined in the help center." – Qiaochu Yuan, Daniel Loughran, Felipe Voloch
• "MathOverflow is for mathematicians to ask each other questions about their research. See Math.StackExchange to ask general questions in mathematics." – Yemon Choi, Stefan Kohl
If this question can be reworded to fit the rules in the help center, please edit the question.

1/6 is 0.1666... ; 1/7 is 0.142857... –  J. M. Oct 11 '10 at 1:53
Otherwise, this might be more suitable for math.stackexchange.com –  J. M. Oct 11 '10 at 1:54
1/6 = 0.16666...thanks for the correction –  user9934 Oct 11 '10 at 1:59
That 1/11 is really 1/12. –  Gerry Myerson Oct 11 '10 at 2:28

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 \}$.

Lemma: if gcd$(k,10) =1$ then $k$ has a multiple of the form $999...9$.
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.