# Math Help - Repeating decimals

1. ## Repeating decimals

I discovered that the decimal representation of 15/17 consists of an endlessly repeating sequence of 16 digits. I wonder what rational number has the longest sequence of repeating digits?

2. Thinking more about this, it occurs to me that a rational number expressed as a fraction having arbitrarily long numerator and denominator that differ by 1 can have an astronomically long sequence of repeating digits in the decimal representation.

3. Originally Posted by StevenBrown
Thinking more about this, it occurs to me that a rational number expressed as a fraction having arbitrarily long numerator and denominator that differ by 1 can have an astronomically long sequence of repeating digits in the decimal representation.
You're getting there (actually the sequence is unlimited as you progress through the fractions)

4. You might find useful this reference (also the other subheadings)

Wikipedia - Repeating decimal - subheading Other properties of repetend lengths

You might also like to think backwards; given any positive decimal expansion with a repetend, we can find unique positive integers p,q such that gcd(p,q)=1 and p/q has the given value.

5. It occurred to me that a repeating decimal such as 15/17 =

0.8823529411764705 8823529411764705 8823529411764705 ...

is "going fractal," in the sense that the same pattern repeats endlessly on smaller and smaller scales.

6. Hello, StevenBrown!

You discovered this on your own? . . . Good for you!
Keep exploring . . . there's some fascinating stuff out there!

I discovered that the decimal representation of $\frac{15}{17}$
consists of an endlessly repeating sequence of 16 digits.
I wonder what rational number has the longest sequence of repeating digits?

Considerable exploration has already been done on this subject.

Here are some basics that I remember . . .

If $p$ is a prime, the decimal for $\frac{1}{p}$ has a $p-1$ digit repeating cycle.

However, some primes can have even shorter cycles.

For example: . $\begin{Bmatrix}\frac{1}{11}\text{ has a 2-digit cycle:} &0.\overline{09} \\ \\[-3mm]
\frac{1}{13}\text{ has a 6-digit cycle:} & 0.\overline{076923} \\ \\[-3mm]
\frac{1}{37} \text{ has a 3-digit cycle:} & 0.\overline{027}\end{Bmatrix}$

What determines the length $n$ of the cycle for prime reciprocals?

It is the least $n$ for which $10^n-1$ is divisible by $p.$

In baby-talk, consider a string of 9's.
Begin dividing by a prime $p.$
When it "comes out even", stop.
The number of 9's is the length of the cycle.

Example: $\frac{1}{7}$

The first time the division stops is: . $999999 \div 7 \,=\,142857$
. . Therefore, $\frac{1}{7}$ has a 6-digit cycle.

Example: $\frac{1}{37}$

The first time the division stops is: . $999 \div 37 \,=\,27$
. . Therefore, $\frac{1}{37}$ has a 3-digit cycle.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Here's another interesting feature . . .

. . $\begin{array}{ccc}
\frac{1}{7} &=& 0.\overline{142857} \\ \\[-3mm]
\frac{2}{7} &=& 0.\overline{285714} \\ \\[-3mm]
\frac{3}{7} &=& 0.\overline{428571} \\ \\[-3mm]
\frac{4}{7} &=& 0.\overline{571428} \\ \\[-3mm]
\frac{5}{7} &=& 0.\overline{714285} \\ \\[-3mm]
\frac{6}{7} &=& 0.\overline{857142} \end{array}$

The last five decimals are cyclic arrangements of the first one.