How do you calculate how many decimal places there are before the repeating digits, given a fraction that expands to a repeating decimal?
Rewrite the fraction as $$\frac{m}{n}=\frac{p}{10^sq}$$ where $p,q$ are coprime and $q$ is not divisible by $2$ or $5$ while $p$ is not divisible by $10$. Computing $s$ (the pre-period) is easy; it is the larger of the number of times $2$ divides $n$ and the number of times $5$ divides $n$. Then we want the smallest $t$ such that $10^t\equiv 1\;(\bmod\;q)$. By Fermat's little theorem, we have $10^{\varphi(q)}\equiv 1\;(\bmod\;q)$, thus $\;t|\varphi(q)$ so it suffices to check the divisors of $\varphi(q)$.