Predicting the number of decimal digits needed to express a rational number

The number $1/6$ can be expressed with only two digits (and a repeat sign denoted as $^\overline{}$), $$ \frac{1}{6} = \,.1\overline{6}$$ Meanwhile, it takes 49 digits to express the number $1/221$, since a string of 49 digits repeats: $$\frac{1}{221} = .\overline{004524886877828054298642533936651583710407239819}$$ Yet for $1/223$, 222 digits repeat, giving a total of 224 digits needed to express the number.

If $f:\mathbb{Q}\rightarrow\mathbb{N}$ is a function that gives the smallest number of digits needed to express a rational number in decimal notation, what can we say about $f$?

For example, if we do not consider the negative sign to be a digit, then $f$ is an odd function. Other than that, is there any pattern to it at all?


Consider the fraction $1/m$. Write $m=2^a 5^b v$ with $\gcd(v,10)=1$. Then the periodic part of $1/m$ has length $e$, where $e$ is the smallest positive number such that $v$ divides $10^e-1$. The non-repeating part has length $f=\max(a,b)$.

There are no easy formulas for either $e$ or $f$ in terms of $m$.