How to convert a decimal to a fraction easily?

Here's a different way to proceed, using as little as possible of the theory of continued fractions. First write $$\frac01 < 0.3760683761 < \frac11$$ so right away we have a pair of fractions that approximate 0.3760683761. They are not very good approximations though!

Now if we have $\frac ab$ on the left and $\frac cd$ on the right, we should check $\frac{a+c}{b+d}$ to see where it lies. In this case $\frac ab = \frac01$ and $\frac cd = \frac 11$ so $\frac{a+c}{b+d} = \frac{0+1}{1+1} = \frac12 = 0.5$:

$$\frac01 < 0.3760683761 < \frac12< \frac 11$$

so forget about $\frac11$, which is too big. Now repeat: Next is $\frac{0+1}{1+2} = \frac13$, which is too small:

$$\frac01< \frac13 < 0.3760683761 < \frac12$$

Next is $\frac{1+1}{2+3} = \frac25$, which is too big:

$$\frac13 < 0.3760683761 < \frac25 < \frac12$$

Next is $\frac{1+2}{3+5} = \frac38 = 0.375$, which is an excellent approximation:

$$\frac13 < \frac38 < 0.3760683761 < \frac25 $$

Unfortunately for this example, there is no better approximation than $\frac38$ until we get to $\frac{44}{117}$. usually the convergence is quicker, but this happens to be an unusually badly-behaved example, and so takes several more steps:

$$\frac13 < \frac38 < \frac{44}{117} < 0.3760683761< \frac{41}{109} < \cdots < \frac{17}{45} < \frac{14}{37} < \frac{11}{29} < \frac8{21} < \frac 5{13} < \frac25 < \frac12$$

But it does find $\frac{44}{117} \approx .37606837606837606837$, which is extremely close, and perhaps is what you were looking for. On the other hand perhaps $\frac 38$ was close enough and you could stop there.

If you want $0.3760683761$ exactly, you can continue the process, which will eventually terminate with exactly $\frac{3760683761}{10000000000}$.

One pleasant feature of this algorithm is that it always produces fractions in lowest terms, so you never have to worry about reducing them afterwards.

The theory of continued fractions provides a way to perform this calculation much more quickly, producing the continued fractional result $$0.3760683761 \approx \cfrac1{2+\cfrac 1{1+\cfrac1{1+\cfrac1{1+\cfrac1{14}}}}}$$


First note that $.\overline{376068}\cdot (1000000-1)=376068$. It follows that $$.\overline{376068}=\frac{376068}{999999}=\frac{572}{1521}.$$ Edit with more details.

In your example you have a repeating decimal $.\overline{376068}=.376068376068376068...$

Let $x=.\overline{376068}$. If we multiply by $1000000$ we get $$1000000x=376068.376068376068...$$ If we now subtract $x$ we have $$1000000x-x=376068.\overline{376068} -0.\overline{376068}=376068.$$ It follows that $(1000000-1)x=376068$ and $x=\frac{376068}{999999}$. Reducing this fraction gives the result you are looking for.

In general, if you have a terminating decimal you can multiply and divide by an appropriate power of ten (i.e. $1.5=1.5\cdot\frac{10}{10}=\frac{15}{10}=\frac{3}{2}$). In the case of a repeating decimal, you can generalize the technique that I used above. Note that I used $10^6=1000000$ in the solution as the repeating part of the decimal is six digits long. If you have a non-terminating non-repeating decimal then you cannot write it as a fraction.

Hope that helps!


Note that any terminating decimal form can be written by multiplying the number by a power of $10$ until you get an integer, and then dividing by a power of $10$ until you get the original number.

In that sense, $1.5=\frac{15}{10}$ and the problem becomes factoring those two numbers. In this case we end up with $\frac{3\cdot5}{2\cdot5}$ which simplifies to the result.

Thus, for your example, the problem is really just finding the prime factorization of $3760683761$ and, since the denominator will be powers of $10=2\cdot5$, you can cancel out all powers of $2$ and $5$ that you can, and the result is further irreducible.