For any natural number $n>1$, we write the infinite decimal expansion of $\frac 1n$ (for example, $\frac 14$ is written as $0.24999$... instead of $0.25$). We need to determine the length of the non-periodic part of the infinite decimal expansion of $\frac 1n$.
I tried many methods, a somewhat promising one was to assume $\frac 1n$ to be some $0.abbbbb$..., where ‘$a$’ denotes the non-recurring part which has $r$ digits including zero, while ‘$b$’ is the recurring part. But I get stuck at deciding the lower and upper bounds for $r$. Please help.
(Please note: this is my first post on this website. So if I have to improve the way I should post the question in, please let me know how to correct the errors in my post. Thanks.)
Lemma:
Proof: Suppose that the statement is not true, i.e. $10^k-1\not\equiv0 \pmod n$ for all values of $k$. There are infinitely many values of $k$ and just $n-1$ possible values ($1\dots n-1$) for $10^k-1\pmod n$. So by pidgeon hole principle there are two different values $k_1, k_2$ such that:
$$10^{k_1}-1\equiv10^{k_2}-1\pmod n,\quad (k_1>k_2)$$
This simply means that:
$$10^{k_1}-10^{k_2}\equiv0\pmod n$$
$$10^{k_2}(10^{k1-k2}-1)\equiv0\pmod n$$
Number $n$ has no factors 2 and 5 so obviously $n\nmid 10^{k_2}$ which implies that $n\mid(10^{k_1-k_2}-1)$ or:
$$n\mid10^k-1$$
...where $k=k_1-k_2$.
End of lemma proof.
Part 1:
Let us now show that:
...where $a$ stands for a group of repeating digits (possibly starting with zero) of length $l_a$. For example for $n=7$: $1/7=0.\overline{142857}$, so $a=142857$ and $l_a=6$.
One can easily show that (1) can be rewritten in the following way:
$${\frac1n}=\frac{a}{10^{l_a}-1}$$
$$a=\frac{10^{l_a}-1}{n}$$
According to our lemma, it's guaranted that there exists $l_a$ such that $n\mid 10^{l_a}-1$ so it's is possible to find $a$ for every $n$ such that $1/n=0.\bar{a}$, without a pre-periodic part.
Part 2
...with the lenght of pre-periodic group of digits $b$ equal to $l_b$ and length of periodic group of digits $a$ equal to $l_a$.
Suppose the pposite, that there is some number $n$ divisible by either 2 or 5 such that:
$$\frac1n=0.\bar{a}=\frac{a}{10^{l_a}-1}$$
$$na=10^{l_a}-1$$
...which is impossible because the LHS is divisible by 2 or 5 and the RHS is clearly not.
Based on part 1 and 2 we now know that:
Part 3
It can be easily proved that any number of the form $0.b\bar{a}$ can be written as:
$$0.b\bar{a}=\frac{b}{10^{l_b}}+\frac{a}{10^{l_b}(10^{l_a}-1)}\tag{3}$$
Because $m$ is not divisible by 2 or 5, we can write $1/m$ as:
$$\frac1m=\frac{a}{10^{l_a}-1}$$
which means that:
$$\frac1n=\frac1{2^p5^q} \cdot \frac1m$$
If we introduce:
$$r=\max(p,q)$$
we get:
$$\frac1n=\frac{2^{r-p}5^{r-q}}{10^r} \cdot \frac1m=\frac{2^{r-p}5^{r-q}a}{10^r(10^{l_a}-1)}\tag{4}$$
Now look at (4) carefully.
Case 1:
$$2^{r-p}5^{r-q}a<10^{l_a}-1$$
By comparing (3) and (4), the length of pre-periodic part is $r$, and the pre-periodic part is made of zeroes $b=0$. Periodic part is equal to $2^{r-p}5^{r-q}a$ and the length of the periodic part is $l_a$.
Case 2:
$$2^{r-p}5^{r-q}a>10^{l_a}-1$$
In that case you can write:
$$2^{r-p}5^{r-q}a=s(10^{l_a}-1)+a_1$$
...and (4) becomes:
$$\frac1n=\frac{s(10^{l_a}-1)+a_1}{10^r(10^{l_a}-1)}=\frac{s}{10^r}+\frac{a_1}{10^r(10^{l_a}-1)}$$
By comparing the last expression with (4), the length of the pre-periodic part $s$ is again $r$ and the length of repeating sequence $a_1$ is again $l_a$.
Interesting example
$$\frac{1}{19}=0.\overline{052631578947368421}$$
Periodic part has 18 digits. Now take a look at:
$$\frac{1}{760}=\frac{1}{2^3\cdot5\cdot19}=0.001\overline{315789473684210526}$$
Pre-periodic part has length 3 (because the biggest power of 2 or 5 in $n=760$ is 3). And the periodic part has length 18, same length as in $1/19$.