Repeating decimals in any base
My previous post ended with a discussion of repeating binary decimals such as
0.00110011...two = 1/5.
For this post I'll explain how calculations like that are done, how to convert a repeating decimal in any base to a fraction.
First of all, we only need to consider repeating decimals of the form
0.1b, 0.01b, 0.001b, etc.
because every repeating decimal is an integer times an expression like one above. For example,
0.424242... = 42 * 0.010101...
You can think of that example as base 10, but it's equally true in any base that has a 4, i.e. any base greater than 4.
Now suppose we have an expression
in base b.
We can see that this expressions is
by summing a geometric series.
So going back to our example above,
If we're working in base 10, this equals 1/99. If we're working in hexadecimal, this is 1/FFhex = 1/255.
I'll finish with a duodecimal example. Suppose we have
0.7AB7AB7AB...twelve
and want to convert it to a fraction. We have
Or 1139/1727 in base 10.
The post Repeating decimals in any base first appeared on John D. Cook.