Remember from my previous post that we’re trying to find the prefix length and repetend length of the decimal expansion of a fraction , that is, the length of the part before it starts repeating, and the length of the repeating part. In that post I showed how to reduce it to the following question:
What are the smallest values of and such that is evenly divisible by ?
and I left it at that, with some questions for thought.
Can you see why we get to determine the values of and separately, i.e. neither value influences the other at all?
The reason we get to consider and separately is that and cannot possibly share any prime factors in common. only has 2 and 5 as prime factors; on the other hand, cannot have 2 or 5 as prime factors since it is equivalent to and . So the original question splits into two independent questions: (1) What is the smallest value of such that cancels all the factors of and in ? (2) What is the smallest value of such that cancels all the other prime factors in ?
The first sub-question is easy enough to answer: if , where has no factors of or , then choosing is both necessary and sufficient: it will be just enough to cancel all the factors of and in .
Let’s see how this works. The example we looked at last time was . If we factor we get , so our analysis above says , since there are two factors of . And sure enough, the decimal expansion has a prefix of length .
As another example, let’s pick a denominator by its factorization: suppose we have a denominator of . 5 has a higher exponent than the 2, so we predict the prefix will have length 4: and sure enough, for example,
We can try other numerators too, we just have to make sure they are relatively prime to . For example,
In my next post I’ll talk about how to find the repetend length!