In a previous post, I noted that the length of the repetend (repeating portion of the decimal expansion) of a fraction with prime denominator p is at most p-1, and in fact divides p-1. I also said:
In fact, there’s even more that can be said about non-prime denominators, as well.
This was something of a cop-out, and today I’m going to correct that! In general, suppose the denominator d can be factored as
that is, d can be factored as the product of the prime to the power, the prime to the power, and so on. (For example, .) Then it turns out that the length of the repetend of any fraction with denominator d will be a divisor of
(The denotes a product; you can read about the notation here if you haven’t seen it before.) When d is prime, we can see that this just reduces to d-1 as we would expect. For each additional prime p in the factorization, we multiply by p-1; for each additional power of a prime p beyond the first, we multiply by p.
So, for example, the repetend length for fractions with denominator 221 = 13*17 should evenly divide ; and indeed, the repetend length of 1/221 is 48. As another example, the repetend length of is 726, which indeed divides .
You may wonder how I know this. Well, asking for the repetend length of a fraction with denominator d amounts to asking for the smallest power of 10 whose remainder, when divided by d, is 1. Another way to say this is that we want to know the order of the element 10 in the group (the group of positive integers less than and relatively prime to d under multiplication). By Lagrange’s Theorem, the order of any element of a group divides the order of the group; so the question becomes, what is the order of ? The answer, as explained e.g. on p. 155 of Contemporary Abstract Algebra by Joseph Gallian (Houghton Mifflin, 2002), is the above formula.
Now, maybe that went way over your head. It certainly did if you’ve never studied any group theory. But I don’t know a simpler way to explain it! Perhaps there is a better way, and if you know of one, I’d love to hear about it in the comments. Nonetheless, this is a great example of a simple question that quickly leads into some very deep structure.
You may also wonder how on earth I know that the repetend length of 1/17303 is 726! No, I didn’t sit there and do long division; of course, I wrote a computer program. Perhaps I will post it soon.