What is the formula for the decimal representation of $\frac{a}{b}$ where $b$ is not coprime to 10?

241 Views Asked by At

If we want to turn a proper fraction $\frac{a}{b}$ into a decimal, then when $b$ is coprime to 10 we just need to rewrite $\frac{a}{b}$ in the form $$\frac{m}{10^{\phi(b)}-1}$$ where $\phi$ is Euler's totient function. And then the repeatend is $m$ and the period of repetition is $\phi(b)$. (This follows from Fermat's Little Theorem.)

But my question is, what do we do when $b$ is not coprime to 10? In that case we would need to rewrite $\frac{a}{b}$ in the form $$\frac{k + \frac{l}{m}}{10^n}$$ where $k < 10^n$, $\frac{l}{m}$ is a proper fraction, and $m$ is coprime to 10. Then $k$ would be the non-repeating part, $n$ would be the length of the nonrepeating part, and we can convert $l/m$ into a decimal using the procedure given in the beginning of my post.

But is there a formula for the four numbers $k$, $l$, $m$, and $n$ in terms of $a$ and $b$, short of doing long division to convert the fraction into a decimal?

1

There are 1 best solutions below

0
On BEST ANSWER

This turned out to be easier than I thought. Let $n$ be equal to the maximum of the number of factors of 2 in $b$ and the number of factors of 5 in $b$. Now write $\frac{a}{b}$ as $$\frac{10^n\frac{a}{b}}{10^n}$$ Then the new fraction you have in the numerator will now have have a denominator that's coprime to 10, since the $10^n$ gets rid of all the factors of 2's and 5's that were present in the denominator. And we can now use the procedure given in the beginning of my question (after changing the fraction in the numerator into a mixed number to separate out the non-repeating and repeating parts).