Today, I’d like to answer some of the questions I raised in the Decimal Expansion Zoo:
- Which decimal expansions terminate, and which are repeating—and how does it relate to the denominator?
As we know, the decimal expansion of every rational number either terminates or repeats—but in a sense, they all repeat; the ones that “terminate” just happen to repeat the digit zero. That is, 0.25 is really just 0.25000000…. This should give us a clue that the “terminating” is not really a fundamental difference, but an artifact of the particular way we’ve chosen to represent numbers, in base 10. And indeed, as you can check, the fractions with terminating representations are those whose denominators are divisible only by 2 and 5 (since 2 and 5 are the divisors of 10). If we used, say, base 21 instead of base 10, the fractions with terminating representations would be the ones whose denominators are divisible by only 3 and 7, and so on.
- How are the different cycles for a given denominator related to each other, and why?
If some fraction has a decimal expansion with a repeating portion like [abcde], then every cyclic rearrangement of [abcde] (that is, [bcdea], [cdeab], [deabc], and so on) also occurs as the expansion of some other fraction with the same denominator. To see why this is so is not hard if you think about the process of long division; the remainder at each step uniquely determines the next remainder, and so on, so given the same divisor, we are always going to see the exact same sequence of digits in the decimal expansion following a given remainder.
- How are the lengths of the cycles for a given denominator related to the denominator itself?
The length of the repeating unit is less than or equal to one less than the denominator. That’s cool.
Indeed! And understanding why this must be the case is not hard, again, if we think about the process of long division to produce the decimal expansion for some fraction. Suppose the fraction has denominator d. At each step of the long division, we must get a remainder less than d. If we ever get a remainder of zero, the expansion terminates. If we ever get a remainder that we’ve seen before, the expansion will begin to repeat. So, the longest an expansion can possibly go before repeating is (d-1).
However, as noted by silverpie, there’s more:
Not only is it always less than or equal to d-1; for prime denominators, it’s a divisor of d-1. (The quotient is equal to the number of different patterns–13, for example has 12/6 or two 6-digit patterns.)
This is true! In fact, there’s even more that can be said about non-prime denominators, as well. However, unlike the previous observations, this one is extremely non-obvious. The only way I know how to prove it takes a detour through group theory. Perhaps I’ll write about it some day, but for now I’ll leave you to be amazed. =)