Long division calculator
Long division with every step written out, and the recurring part found exactly rather than guessed at. It works by watching the remainders, because two different remainders can produce the same digit. Nothing you type here leaves your browser — it is worked out on your own device, so there is nothing to send and nothing to log.
Why it must repeat, and how to prove it
Dividing by d, there are only d possible remainders: 0 to d−1. Each step of a long division takes the remainder, multiplies by ten and divides again — so the next remainder depends on nothing but the current one. Once a remainder comes round a second time, everything after it is bound to repeat, forever.
That gives a guarantee rather than an observation: a division either terminates or starts recurring within d steps. This page watches the remainders and stops the moment one returns, so the repeating block it shows is exact.
Watching the digits instead finds cycles that are not there
The obvious shortcut is to watch the digits and stop when one repeats. It is wrong, and it is wrong in the direction that looks right: two different remainders can produce the same digit, so a digit-watcher stops early and reports a shorter cycle than the real one.
1/17 is the example. Its digits are 0588235294117647 — a cycle of sixteen — and there is a repeated digit long before the sixteenth. A digit-watcher calls it after a handful and is confidently wrong. The check behind this page plants exactly that mistake and confirms it goes red.
Which fractions stop, and why
A fraction in lowest terms terminates as a decimal exactly when its denominator's only prime factors are 2 and 5 — the primes that divide ten. Everything else recurs:
| 1/8 | stops after three digits: 8 is 2³ |
|---|---|
| 1/7 | recurs with a cycle of 6 |
| 1/97 | recurs with a cycle of 96 — the longest a denominator of 97 can give |
The cycle length is the multiplicative order of 10 modulo the denominator, which is a fact about that number rather than about this page. The checks verify it that way, computing the order separately and comparing — two routes to the same answer rather than one route checked against itself.