## More on decimal expansions

Today, I’d like to answer some of the questions I raised in the Decimal Expansion Zoo:

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

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

3. 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. =) Assistant Professor of Computer Science at Hendrix College. Functional programmer, mathematician, teacher, pianist, follower of Jesus.
This entry was posted in number theory, pattern and tagged , . Bookmark the permalink.

### 15 Responses to More on decimal expansions

1. JM says:

After thinking a lot I’ve come up with this theory:

The length of the repeating cycle of a fraction with a composite denominator will not excede the length of the cycles of its prime factors.

I’m not completely sure if this is correct, but my proof is that if a repeating decimal is divided, the repeating cycle of the quotient won’t be longer than its own or that of the number it was divided by. You could probably explain that better, but this is a start.

2. pat ballew says:

Another interesting fact about repeating decimals from a blog I wrote awhile back that you might enjoy:
“Look back at 2/7 and another interesting property of repeating decimals may pop out at you. This one was published by Henry Goodwyn in 1802. He noted that if you divide the period into a first half and a second half, the sum of the digits in corresponding positions add up to nine.. For 2/7 above the repeat cycle is 285714 so the halfs are 285 and 714. Note that 2+7 = 8+1= 5+4 = 9, and Goodwyn showed this is true for ALL repeating decimals”
The complete blog is at http://pballew.blogspot.com/2008/08/repeating-decimal-periods-and-patterns.html

3. Brent says:

@JM: That’s a nice conjecture, but I don’t think it’s true; for example, the repetend of 1/(11^2) is 22 digits long, which is longer than the repetend of 1/11. And the repetend of 1/(11^3) is 242 digits long!

@pat: Amazing! However, it doesn’t seem to be true for ALL repeating decimals. For example, it isn’t true for 1/21 = 0. or for 1/31 = 0.. Do you have a link or reference to where you found this?

4. JM says:

Yes, of course, I should have realized sooner. 1/27 is another one that is longer than its factors. It appears that this happens sometimes when there are multiple of one factor.

5. Brent says:

I think it can happen even when there aren’t repeated factors. For example, 1/221 has a repetend of length 48 (221 = 13*17).

6. JM says:

Furthermore, 48=(13-1)/2 times (17-1)/2. There are patterns everywhere!

7. pat ballew says:

Brent,
I think I found it in the book by G. Loweke that I mentioned… maybe it was misprinted, maybe I misread it… could it be possible only for full period repeating decimals, those that have n-1 digits?

8. pat ballew says:

I found a link that explains this in more detail, the pdf is several pages, so I will just provide the link..
http://www.muskingum.edu/~rdaquila/m495/art/Repeating%20Decimals-Arledge.pdf

9. pat ballew says:

and here is the property as expalined at the mathworld site

If the period of a repeating decimal for k/p , where p is prime and k/p is a reduced fraction, has an even number of digits, then dividing the repeating portion into halves and adding gives a string of 9s.

1/21 doesn’t apply because 21 is not prime, 1/31 does not work because the period is 15, not a multiple of two.

10. pat ballew says:

There is a related property to the nines compliment property I mentioned (or mis-mentioned).. if the k/p with k prime has a period divisible by some factor, then dividing the period into parts of that length and summing them will produce a string of nines… for example, 1/31 has a period of 15, which is divisible by three and five.. if you break the decimal into five parts of length three (032+258+064+516+129) you get 999; and if you make three sections of length five, you get 03225+80645+16129= 99999… and I have it on good authority that it will work for ALL fractions with prime denominator..

and for things like 1/21, I notice that if you break the period into three sections of length two, (04+76+19) you also get 999 but in two sections of length three you get (047+619=666)… I think the cycles will always total a repeating number,

also, for JM, I think if the denominator is a product of unique primes, like p and q and the periods of p and q are known, then the length of the period of 1/pq will be the least common multiple of the periods of p and q…for example 1/221 = 1/(13*17) and the period of 1/13 is six, while 1/17 has a period of 16.. the least common multiple of 6 and 16 is 48…
not sure how that plays out for powers

11. JM says:

Pat – I think that when a prime denominator d or a power of d is multiplied by d, then so is the length of the expansion, or it stays the same. For example, 1/3 has a length of 1. 1/3^2 also has a length of 1. But 1/3^3 has a length of 1*3. Whether the expansion length increases or stays the same might have to do with whether d^x and d^(x+1) have the same number of digits or not, but I’m not completely sure. There may be instances where this doesn’t apply at all.

12. Brent says:

pat: excellent, thanks for the link and the further explanation! Neat stuff.

JM: you’re right on the money, actually. After some poking around I’ve figured out the general case for non-prime denominators, which I will write about in an upcoming post.

13. observer says:

Here is a simple way to generalize: Let n, b be relatively prime. Then in base-b, the period length of the expansion of fraction 1/n is the multiplicative order of b mod n. Proof is very simple. Let 1/n = 0.(x) where x is the repeating portion, then 1/n = x/{b^k – 1} by geometric series, so nx = b^k – 1. This holds for some integer x if and only if n|b^k – 1. Therefore, the length is the smallest k such that n divides b^k -1.