GenerateRandomSearch

Repeating Decimal Generator

Every fraction either terminates or repeats forever, and which one it does is decided entirely by the denominator's prime factors. The length of the repeating block is not arbitrary either: it is the multiplicative order of ten modulo the part of the denominator coprime to ten. This performs the long division, marks the repeating block, and then checks the period against that order — two entirely different routes to the same number.

What this generator does

Performs long division while tracking remainders, so the repeating block is identified the moment a remainder recurs. The period is then compared against the multiplicative order of ten, and the digits are used to rebuild the original fraction.

How to use this tool

  1. Enter a numerator and a denominator.
  2. Read the decimal, with the repeating block underlined.
  3. Check the period length against the note beneath.
  4. Try sevenths and thirteenths for the classic long repeating blocks.

Understanding the controls

Numerator and denominator
Any fraction up to four digits each. The denominator does all the work here: the numerator shifts the digits around but never changes the period.

Common use cases

  • Finding the exact repeating block of any fraction
  • Teaching why some fractions terminate and others do not
  • Explaining where the period length comes from
  • Producing recurring decimal examples for a worksheet
  • Checking a long division result against an independent calculation

How this generator works

Long division produces one digit per step, and the remainder at each step is recorded. If a remainder ever repeats, everything from its first appearance onwards must repeat too, which is why every fraction terminates or recurs and nothing else can happen. Before display the period is compared against the multiplicative order of ten modulo the denominator's part coprime to ten — a purely number-theoretic quantity computed separately — and the digits are folded back into a fraction using the standard construction and compared against the original.

Randomness and fairness

Nothing here is random. A fraction has exactly one decimal expansion.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • The rebuilding check is skipped when the digits together exceed fifteen places, since beyond that the reconstruction would exceed exact integer arithmetic.
  • Only base ten is handled; the same theory works in any base with the order taken modulo that base.
  • Denominators are limited to four digits, which caps the period at a few thousand digits.
  • The whole part is shown separately, so improper fractions read as a whole number and a decimal rather than as a single long division.

Privacy and your data

The expansion is computed in your browser. The fraction you enter is never transmitted, stored or included in analytics.