[Math] Upper bound/exact length of decimal expansion of simple fraction

decimal-expansionfractions

E.g. 1/8=0.125 has three decimals when written out in base 10, but what is a good example of a simple fraction where the decimal sequence terminates but is very large?

Is there some sort of rule which determines how many decimals the terminating exact decimal expansion can have based on the amount of digits in the numerator and denominator?

Best Answer

Given a fraction $p/q$, first get it into its lowest terms (so that $p$ and $q$ have no common factor). Then, if $q$ is of the form $2^a5^b$ for integers $a,b$, its decimal expansion has max$(a,b)$ digits after the decimal point. If it's not of this form, its decimal expansion is non-terminating (but repeating).