MathLabs
TheoremProved

When does a fraction terminate as a decimal?

Statement

Let ab\frac{a}{b} be a fraction in lowest terms with b>0b>0 (so gcd⁡(a,b)=1\gcd(a,b)=1). Its decimal expansion terminates (has finitely many nonzero digits) if and only if b=2m5nb=2^m5^n for some integers m,n≥0m,n\ge0.

Why is it true?

Decimal place value is built from powers of 10=2×510=2\times5. A fraction can be rewritten with a denominator that is a power of 1010 exactly when its denominator's only prime factors are 22 and 55 — any other prime factor can never be "absorbed" into a power of 1010.

Proof sketch

(⇐\Leftarrow) Suppose b=2m5nb=2^m5^n. Let k=max⁡(m,n)k=\max(m,n). Multiply numerator and denominator by 2k−n5k−m2^{k-n}5^{k-m} (both exponents are ≥0\ge0 since kk is the max): ab=a⋅2k−n5k−m2m5n⋅2k−n5k−m=a⋅2k−n5k−m2k5k=N10k\dfrac{a}{b}=\dfrac{a\cdot2^{k-n}5^{k-m}}{2^m5^n\cdot2^{k-n}5^{k-m}}=\dfrac{a\cdot2^{k-n}5^{k-m}}{2^k5^k}=\dfrac{N}{10^k}, where N=a⋅2k−n5k−mN=a\cdot2^{k-n}5^{k-m} is an integer. Writing NN in ordinary digits and placing the decimal point kk digits from the right (padding with leading zeros if NN has fewer than kk digits) gives exactly the decimal expansion of ab\frac{a}{b}, and it stops after at most kk digits: it terminates.

(⇒\Rightarrow) Suppose ab\frac{a}{b} terminates after kk decimal digits, i.e. ab=N10k\dfrac{a}{b}=\dfrac{N}{10^k} for some integer NN. Cross-multiplying (Theorem 1 above): a⋅10k=b⋅Na\cdot10^k = b\cdot N, so bb divides a⋅10ka\cdot10^k. Because ab\frac{a}{b} is in lowest terms, gcd⁡(a,b)=1\gcd(a,b)=1, meaning bb shares no prime factor with aa; hence any prime factor pp of bb cannot divide aa, and since pp divides a⋅10ka\cdot10^k it must divide 10k10^k instead. But 10k=2k5k10^k=2^k5^k, whose only prime factors are 22 and 55. So every prime factor of bb is 22 or 55, which means b=2m5nb=2^m5^n for some m,n≥0m,n\ge0.

Topics that use this theorem

Step-by-step proofs

No step-by-step proof yet for this theorem.

References

  1. David M. Burton (2010). Elementary Number Theory
  2. John H. Conway, Richard K. Guy (1996). The Book of Numbers · DOI:10.1007/978-1-4612-4072-3