One can use modular arithmetic to find the decimal expansion of a rational number. (see 1: https://i.stack.imgur.com/kw4Gk.png).
Using the same method I have run into a couple of problems.
- $x = \frac{1}{6}$
In this case $m =1$ and $n=6$. Then the remainders are $1, 10 \equiv 4, 40 \equiv 4, ...$
so therefore $10^2 \cdot 1 \equiv 10^1 \cdot 1 \pmod{6}$. Now $10^2-10^1 = 90 = 6 \cdot 15$ and so $\left(10^2 -10^1\right)x = 15$, but doing long division $x = 0.1\overline{6}$ and not $x = 0.1\overline{15}$. I am not really understanding the final step to determine $x$.
- $x = \frac{1}{37}$.
In this case $m =1$ and $n =37$. Then the remainders are $1, 10 \equiv 10, 100 \equiv 26, 260 \equiv 1.$ So $10^3 \cdot 1 \equiv 1 \pmod{37}$. Now $10^3 -1 = 999 = 27 \cdot 37$. Therefore so $(10^3-1)x =27$, and by method above $x = 0.\overline{27}$, but doing long division $x = 0.\overline{027}$.
Clearly I am doing something wrong, the method should work for both of these cases. However I am not sure what it is?