r = 3.[14] = 3.141414...I don't have to multiply this by an infinite power of 10. It turns out that I only need to multiply by a power of ten with the same magnitude as the length of the repeating part.

For this example the repeating sequence, [14], is n=2 digits long. So I multiply r by 10

^{n}= 10

^{2}= 100 and get

100r = 314.[14] = 314.141414...The reason I've explicitly written equations for r and 100r, is that I want to subtract one equation from the other and make the messy repeating decimal disappear, leaving me with just an integer:

(100r - r) = 99r = 314.[14] - 3.[14] = 311Then I solve for r.

r = 311/99This is already reduced, since 311 and 99 are coprime, since 311=311 and 99=3*3*11.

Here's another example:

r = 0.[142857]What is the length of the repeating part? The repeating sequence is 6 digits long, so multiply r by 10

^{6}, and get

1000000r = 142857Then subtract these two equations and solve for r.

(1000000r - r) = 999999r = 142857 r = 142857/999999Reducing this fraction is going to take some doing. Again I am using Octave's "factor()" and "gcd()" commands to help with the heavy lifting.

It turns out that:

r = 142857/999999 = (3*3*3*11*13*37)/(3*3*3*7*11*13*37) = 1/7

So what about those occasions when there is a sequence to the right of the decimal that does not repeat, followed by a sequence that does repeat? I think that is the the most general case, and the hardest decimal-to-fraction problem to solve. For example:

r= 3.45[6]There are couple of ways to do this one. One way is to find 1000r, 100r, and then subtract these to get 900r.

r= 3.45[6] 1000r = 3456.[6] 100r = 345.[6] 900r = 3111 r = 3111/900 = 3*1037/3*300 = 1037/300