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?

  • $\begingroup$ if $b$ is not co-prime to $10$, then you an break $\frac ab$ into a repeating and a finite decimal. $\endgroup$ – Doug M Dec 8 '16 at 2:02
  • $\begingroup$ @DougM Yes I know, that's why I said I want to rewrite $\frac{a}{b}$ as $\frac{k + \frac{l}{m}}{10^n}$ where $m$ is coprime to 10. $\frac{k}{10^n}$ is the finite decimal and $\frac{l}{m}$ yields the repeating decimal (although shifted $n$ digits to the right). Now it's just a matter of finding formulas for $k$, $l$, $m$, and $n$. $\endgroup$ – Keshav Srinivasan Dec 8 '16 at 2:24

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).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.