Write out \dfrac{1}{7} as a decimal and something strange happens. You get

\frac{1}{7} = 0.\overline{142857} = 0.142857142857142857\ldots

Six digits, then the same six digits again, forever. Not five, not seven — six, exactly. Change the fraction to \tfrac{1}{11} and the repeat length is 2. Change it to \tfrac{1}{13} and it jumps to 6 again. Change it to \tfrac{1}{17} and the repeat length is 16. Where are these numbers coming from?

The pattern is not magic. It drops out of a small observation about long division — and once you see it, you can predict the repeat length of any fraction without ever doing the division.

The remainders are doing the work

When you long-divide 1 by 7, you are repeatedly computing remainders. Watch the remainders carefully.

At step 7, the remainder is 1 again — the same remainder we started with. The moment the remainder repeats, the entire sequence of quotient digits is forced to repeat too, because from here onward we are asking the same division questions in the same order. The quotient digits we collected — 1, 4, 2, 8, 5, 7 — form the repeating block.

Long division remainders cycling for one divided by sevenA ring of six boxes arranged in a circle, each labelled with a remainder of long division by seven. The remainders are one, three, two, six, four, five, in order around the ring, with arrows connecting each to the next. A seventh arrow returns from five back to one, closing the cycle. Inside each box the corresponding quotient digit from the expansion of one over seven is shown. r=1 d=1 r=3 d=4 r=2 d=2 r=6 d=8 r=4 d=5 r=5 d=7 r=1 back to start six distinct remainders → six-digit repeat
The six remainders of long-dividing $1$ by $7$ form a closed cycle: $1 \to 3 \to 2 \to 6 \to 4 \to 5 \to 1$. Each remainder determines the next quotient digit, and when the cycle returns to $1$ the decimal digits repeat. The repeat length of $\tfrac{1}{7}$ is the length of this cycle — six.

Why the cycle must close

At every step of long division by 7, the remainder is a number between 0 and 6 — there are only 7 possible values. Exclude 0 (which would terminate the division), and you are left with 6 possible non-zero remainders: \{1, 2, 3, 4, 5, 6\}.

You can produce at most 6 new remainders before you are forced to repeat one. That is a pigeonhole argument — six pigeonholes, seven pigeons, two must share. In practice, for \tfrac{1}{7}, all six non-zero values appear exactly once, and then the cycle closes on itself.

Why: once a remainder repeats, the same division sub-problem is being set up again, so the same quotient digit comes out, and the next remainder is determined, and so on. The decimal digits from that point onward are an exact copy of the digits from the first occurrence. Repetition of one remainder forces repetition of all remainders downstream.

The general rule

Here is the result that pops out.

The repeat length of \tfrac{1}{q} is the smallest integer k \geq 1 such that 10^k \equiv 1 \pmod{q}.

This looks technical, but it is saying exactly what we saw above. The remainders of long division are the successive values of 10, 100, 1000, \ldots taken mod q. When one of those hits 1, the division cycle returns to its start. The smallest such exponent is the length of the cycle.

Let us check a few:

q smallest k with 10^k \equiv 1 \pmod{q} repeat length decimal
3 10^1 = 10 \equiv 1 1 0.\overline{3}
7 10^6 = 1000000 \equiv 1 6 0.\overline{142857}
9 10^1 = 10 \equiv 1 1 0.\overline{1}
11 10^2 = 100 \equiv 1 2 0.\overline{09}
13 10^6 \equiv 1 6 0.\overline{076923}
17 10^{16} \equiv 1 16 0.\overline{0588235294117647}
19 10^{18} \equiv 1 18 0.\overline{052631578947368421}

For q = 7, the powers of 10 mod 7 are 10 \equiv 3, 10^2 \equiv 2, 10^3 \equiv 6, 10^4 \equiv 4, 10^5 \equiv 5, 10^6 \equiv 1. Six steps to get back to 1. Six-digit repeat.

For q = 11, the powers of 10 mod 11 are 10 \equiv 10, 10^2 \equiv 1. Two steps. Two-digit repeat.

Powers of ten mod seven and mod elevenTwo parallel horizontal strips. The top strip labelled mod seven shows the successive powers of ten modulo seven landing on three, then two, then six, then four, then five, then one, taking six steps before cycling. The bottom strip labelled mod eleven shows the powers of ten modulo eleven landing on ten then one, a short cycle of two steps. 10^k mod 7: 3 2 6 4 5 1 k=6 ← cycle 10^k mod 11: 10 1 k=2 ← cycle short cycle → short repeat
The repeat length of $\tfrac{1}{q}$ is the number of steps the sequence $10^k \bmod q$ takes to return to $1$. For $q = 7$, the sequence visits six different values before returning. For $q = 11$, it returns in just two steps. The repeat length is the cycle length — not one digit more, not one digit less.

Why the length divides q - 1

A deeper fact: for prime q (not 2 or 5), the repeat length always divides q - 1. That is why the repeat lengths for 7, 11, 13, 17, 19 are 6, 2, 6, 16, 18 — each a divisor of q - 1.

This is a consequence of Fermat's little theorem: for any prime q and integer a coprime to q, a^{q-1} \equiv 1 \pmod{q}. Applied to a = 10, this says 10^{q-1} \equiv 1 \pmod{q}, which means the repeat length (the smallest exponent that makes 10^k \equiv 1) divides q - 1. The possible repeat lengths for \tfrac{1}{7} are therefore the divisors of 6: 1, 2, 3, 6. We observed it to be 6 — the maximum.

When the repeat length equals q - 1, the prime q is called a full reptend prime. The primes 7, 17, 19, 23, 29, 47, 59, 61, \ldots are full reptend; 11, 13, 31, 37, 41, 43, \ldots are not. For a full reptend prime, every non-zero remainder from 1 to q - 1 appears exactly once in the cycle — which is why \tfrac{1}{7} visits all of \{1, 2, 3, 4, 5, 6\} before returning.

What this tells you about \tfrac{1}{7} specifically

The six-digit block of \tfrac{1}{7} is 142857. Because 7 is a full reptend prime, the decimals of \tfrac{2}{7}, \tfrac{3}{7}, \tfrac{4}{7}, \tfrac{5}{7}, \tfrac{6}{7} are all cyclic shifts of the same six digits:

Same six digits every time — only the starting point rotates. This is a mathematical beauty that falls out of the remainder cycle: multiplying by k just skips you k steps around the cycle.

And one more: 142857 \times 7 = 999999. Multiply any full-reptend repeat block by its denominator and you get a string of 9s. This is equivalent to \tfrac{1}{q} \times q = 1, spelled out in the decimal world.

The rule for composite denominators

For a denominator that is not prime — say \tfrac{1}{12} or \tfrac{1}{21} — strip out any factors of 2 and 5 first (those cause a non-repeating pre-period, not the repeat itself), then the repeat length of the remaining part is determined by the same rule: smallest k with 10^k \equiv 1 mod (the remaining factor).

The factors of 2 and 5 cleanly "move" a copy of the decimal point to create a finite prefix, and the rest of the denominator decides the repeat length. That is why "terminate vs. repeat" depends on 2s and 5s, but "how long the repeat is" depends on the other primes. (See how to tell termination from the denominator for the terminate/repeat half of the story.)

What to remember

So the six-digit block of \tfrac{1}{7} is not a coincidence. It is the shortest cycle of remainders when you repeatedly multiply by 10 in the world modulo 7 — and that cycle is forced to close within six steps because there are only six non-zero remainders available. The decimal expansion is the shadow cast by a piece of clean modular arithmetic.

Related: Fractions and Decimals · How to Know If a Fraction Terminates or Repeats — Without Doing the Division · Long Division Reveals the Repeating Block — Watch the Loop Appear · Repeating-Decimal Patterns: 1/7, 1/11, 1/13 Side by Side