2.5.3 · D4Number Theory (Intermediate)

Exercises — Rational numbers — definition, decimal expansion (terminating - repeating)

3,218 words15 min readBack to topic

Before we start, one picture ties the whole page together: the fork every fraction runs into when you convert it to a decimal.

Figure — Rational numbers — definition, decimal expansion (terminating - repeating)
Alt-text / text-only version of the figure: A flowchart with one top box and two bottom boxes. Top box: "Take in lowest terms, factor the denominator ." From it, two arrows descend. Left arrow, labelled "only 2 and 5", leads to the left bottom box: " → TERMINATES, e.g. ." Right arrow, labelled "some other prime", leads to the right bottom box: " has a prime not in → REPEATS forever, e.g. ". Beneath both sits a strip: "Repetend length divides ."

How to read this figure (colour-independent): the arrows are only there to point; you never need to see their colour. Start at the top box, factor , and answer one yes/no question: does the reduced denominator contain any prime other than 2 or 5? If no, take the left path → the decimal stops. If yes, take the right path → it repeats forever. The bottom strip records the bonus fact used from Level 3 onward: when it repeats, the repetend length must divide (Euler's totient). Keep this single fork in your head.

Recall Why must the repetend length divide

? (Euler's theorem sketch) Take with (no 2s or 5s in ). In long division the remainders follow the rule (see Modular arithmetic). Starting from , after steps the remainder is . The decimal repeats exactly when a remainder returns to — that is, when . The smallest such is called the order of 10 mod , and it equals the repetend length.

Now Euler's theorem says: for any coprime to , In particular , so is one exponent that works. The smallest working exponent (the order) must divide every working exponent — because if the order is and some other exponent also gives , write with remainder ; then too, and since is smallest we're forced to , i.e. . Taking gives . That is precisely "repetend length divides ." ∎


Level 1 — Recognition

You only need to classify: will this decimal terminate or repeat? No long division required.

Recall Solution 1.1

The rule (from the parent note): write the denominator in lowest terms, then factor it. If only the primes 2 and 5 appear → terminates. Any other prime → repeats.

  • : (already lowest terms), and . Only 2 and 5 → terminates.
  • : , and . The prime appears → repeats.
  • : , and . Only 2 and 5 → terminates.
  • : , and . The prime appears → repeats.
Recall Solution 1.2

Trap-avoidance first: reduce before factoring. As given, , which looks like it repeats. But the fraction is not in lowest terms — here , so we can cancel: Now only the prime 2 appears → terminates (indeed ).


Level 2 — Application

Now actually produce the decimal (or the fraction), using the Long division algorithm and the "make the denominator a power of 10" trick.

Recall Solution 2.1

, so it terminates. To reach a power of 10 we need matching factors of 5. We have and no s, so multiply top and bottom by :

= \frac{4375}{10000} = 0.4375.$$ **Why $5^4$?** We need the denominator to be $10^n = 2^n 5^n$. It already has $2^4$, so we balance it with exactly $5^4$ — no more, no less.
Recall Solution 2.2

is a prime other than 2 or 5 → repeats. Track the remainders:

2 ÷ 11:
 remainder 2 → 20 ÷ 11 = 1 remainder 9
 remainder 9 → 90 ÷ 11 = 8 remainder 2  ← remainder 2 again!

Once remainder 2 returns, the block repeats. The repetend (repeating block) is "": Repetend length . (Consistent with theory: and .)

Recall Solution 2.3

Let . Repetend length is 2, so multiply by : Subtract so the infinite tails cancel exactly:


Level 3 — Analysis

Now we reason about why patterns happen, using remainders and Modular arithmetic.

Recall Solution 3.1

Non-repeating part = "16" (2 digits); repeating part = "" (1 digit). We use two multipliers, and here is exactly why those two: one multiplier must slide the decimal point to just past the non-repeating prefix, the other must slide it one full repetend further, so that when we subtract, the two infinite tails sit digit-for-digit on top of each other and vanish.

Multiplier A (, because the prefix "16" is 2 digits) moves the point past the prefix: Multiplier B (, prefix 2 digits plus repetend 1 digit) moves it one repetend further: Line them up and watch the tails:

The two underlined tails are identical — both are starting at the same place — so subtracting them gives exactly . Only the finite whole-number parts survive: . Hence Check: , which is the same as . ✓ The rule this demonstrates: prefix length → subtract from , where is the repetend length. Here , giving and .

Recall Solution 3.2

First, recall exactly how long division turns a remainder into a decimal digit. At each step you take the current remainder , append a zero (i.e. multiply by 10), then ask "how many s fit?"

  • The digit you write down is the whole-number quotient: (the means "round down to a whole number").
  • The next remainder is what's left over: (the leftover after dividing by 7 — see Modular arithmetic).

Run it for starting at :

Reading the middle column top-to-bottom spells — exactly .

Key insight: the same remainder wheel drives for every ; a different numerator just starts the division at a different remainder. For the first remainder is , which sits at the second slot of the wheel. Reading the digit column starting from that slot () gives: Verify quickly:

Figure — Rational numbers — definition, decimal expansion (terminating - repeating)
Alt-text / text-only version of the figure: Six circles arranged in a ring, one per non-zero remainder when dividing by 7. Arrows connect them in the cycle back to , each arrow being the rule . Beside each circle is the decimal digit it produces (): circle produces digit 1, produces 4, produces 2, produces 8, produces 5, produces 7. Two pointers mark where each fraction enters the ring: enters at , enters at . Because both ride the same loop, their decimals are the same cyclic string of digits, just begun at a different circle — that is the entire "cycle-shift" argument.


Level 4 — Synthesis

Combine the ideas — factorisation, Euler's totient function, and long division — to make and justify predictions.

Recall Solution 4.1

Predict: is prime and , so repeats. The length must divide (see the sketch in the intro). Candidate lengths: . So it is at most 12; we must divide to find which divisor.

Confirm with the same two-column table as before (digit , next ), starting at :

The remainder returns after 6 steps, and the digit column spells : And indeed . ✓ The length is a divisor of , not necessarily itself.

Recall Solution 4.2

Split off the whole number: . For : , so , giving . Therefore Sanity check:

Recall Solution 4.3

Let . Repetend length 1, so . Subtract: So is not "just below 1" — it is , written a different way. This is the same subtraction trick used everywhere on this page, applied to a surprising case.


Level 5 — Mastery

Open-ended construction and proof. You are now the one designing the number.

Recall Solution 5.1

A fraction with terminates after exactly digits, because you must multiply up to to clear both prime powers. To force exactly 3 digits, pick with sharing no factor with (i.e. ).

A valid answer: . Here , so: It cannot stop at 2 digits: that would require , but . (Another valid answer: , since , again .)

Recall Solution 5.2

Length 2 means the smallest with is . Test small coprime to 10: for , , and (since ). The order is exactly 2, so: (We reject : gives length 1. We reject : length 6.)

Recall Solution 5.3

Every rational number's decimal either terminates or eventually settles into a fixed repeating block of some finite length (parent note). We argue by contradiction: suppose our number were rational. Then there is a finite block length and a starting position such that from digit onward, the digits repeat with period — every digit equals the one places earlier.

Now use the structure of our number. Its digits are: a , then one , a , then two s, a , then three s, and so on — the runs of consecutive zeros are long and grow without bound. So somewhere past position there is a run of zeros longer than .

Look at one full period-window of digits sitting inside that long run of zeros: it is entirely zeros. By our assumed period- repetition, every window from that point on must be a copy of this all-zero window — meaning from there on the number is all zeros forever.

But that is false: further along, another always appears (the s never stop, since between consecutive s we only ever have a finite run of zeros). This directly contradicts "all zeros forever." Our assumption of rationality collapses. Therefore no finite repeating block exists → the number is irrational. ∎

This is exactly the boundary between rationals and Irrational numbers living inside the Real numbers — and it's why the rationals, though dense, still leave gaps.


Recall One-line self-test

Rational ⟺ decimal terminates or repeats ::: and it terminates ⟺ its reduced denominator is ; otherwise it repeats with length dividing .