For simple fraction, we can easily convert it to repeating decimal by calculator. Ex. $\frac 1 3 = 0.33333\ldots$, $\frac 1 7=0.(142857),\ldots$ But some fraction fraction like $10/29, 1/97,...$ The repeating part of them are too long, so it can't fully show on the calculator. So is there any algorithm to find the repeating part for that fraction?
Question about repeating decimal?
294 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 2 best solutions below
On
For, say, $\large \frac{1}{97}$, start by running the Python program
R = []
numer = 1
denom = 97
for i in range(0,denom):
r = numer * 10**i % denom
try:
ndx = R.index(r)
except:
ndx = -1
if ndx >= 0:
print(i,ndx)
break
R.append(r)
The output of the program is
96 0
The period length is
i - ndx
and is therefore equal to $96 - 0 = 96$.
The offset (to the right of the decimal) is $0$ so the period begins immediately after the decimal.
So we need to put a bar over the first $96$ digits.
To get those decimal digits you can conveniently use wolfram, and compute
integerPart((1 + 1/97) * 10^96)
The output is
1010309278350515463917525773195876288659793814432989690721649484536082474226804123711340206185567
and you have to drop the leading $1$ (used to 'light up' any zeroes right after the decimal point) to get the final answer (with period broken down into blocks of $25$),
$\quad \large \frac{1}{97} =$
$0.\overline{0103092783505154639175257}$
$\; \; \, \overline{7319587628865979381443298}$
$\; \; \, \overline{9690721649484536082474226}$
$\; \; \, \overline{804123711340206185567}$
Yes. Here is one I once wrote in the R language. It uses the 'gmp' (GNU Multiple Precision) package.