2
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ Several questions in this sense have already been asked. Here's one. $\endgroup$ – Raskolnikov Feb 10 '11 at 12:13
  • $\begingroup$ Do you have any restriction on the size of denominator and numerator? $\endgroup$ – Américo Tavares Feb 10 '11 at 12:15
  • $\begingroup$ @Raskolnikov: I wasn't just interested in whether it terminates, but the upper bound on the number of digits I could expect in the decimal expansion when it does. $\endgroup$ – Rune Aamodt Feb 10 '11 at 13:39
  • $\begingroup$ @Americo Tavares: Not really. I was playing around with a programming library that does exact algebraic calculations with scaled decimal representation, and I was just wondering how much memory the result of a division might take in worst case. $\endgroup$ – Rune Aamodt Feb 10 '11 at 13:42
  • 1
    $\begingroup$ Another interesting question in this area is when given a simple fraction to ask how to determine the length of the pattern. $\endgroup$ – Joshua Shane Liberman Feb 10 '11 at 14:30
8
$\begingroup$

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

$\endgroup$
  • $\begingroup$ What's the length of the repeating part in the second case? $\endgroup$ – Mitch Feb 10 '11 at 15:02
  • 1
    $\begingroup$ @Mitch: For the case when q is prime, I refer you to Wikipedia: en.wikipedia.org/wiki/… $\endgroup$ – TonyK Feb 10 '11 at 16:12
  • $\begingroup$ @Mitch: the length of the repeating part is the smallest positive integer $k$ for which $q$ is a factor of $10^k-1$ (this follows from the algebraic method for rewriting a repeating decimal as a fraction). Though the two answers are a bit terse and dense (one of them is mine), you might want to have a look at this question. $\endgroup$ – Isaac Feb 10 '11 at 16:55
  • $\begingroup$ Exactly what I was looking for, thanks. $\endgroup$ – Rune Aamodt Feb 10 '11 at 16:55

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.