# Characterising reals with terminating decimal expansions

Show that a number has a terminating decimal expansion if and only if, it is rational and when in lowest terms, its denominator is coprime to all primes other than $2$ and $5$.

This is an unsolved question in my lecture notes. I can only seem to prove the converse direction for this. Would appreciate a solution for the other direction.

For converse direction:

Let the number, in lowest terms, be given by $\frac{l}{m}$ where $m = 2^ \alpha 5^\beta$, for some positive integers, $\alpha$ and $\beta$.

• If $\alpha > \beta$, let $k = 5^{(\alpha-\beta)}$.

• If $\alpha < \beta$, let $k = 2^{(\beta-\alpha)}$.

Then $\frac{l}{m} = \frac{kl}{k2^\alpha5^\beta}=\frac{kl}{10^q}$ where $q = \max(\alpha,\beta)$.

Hence $\frac{l}{m}$ is a terminating decimal.

-
–  LePressentiment Oct 27 '13 at 7:09

If the denominator has a prime factor other than $2$ and $5$, there is no power of $10$ that it divides. If you assume it terminates after $n$ decimals, the denominator must divide $10^n$
Let $n$ be the terminating decimal in question, and let $a =n\cdot10^m$, where $m$ is the number of places in the decimal expansion after the decimal point. Then $n=\frac{a}{10^m}$, the denominator of which is co-prime to any prime other than 2 or 5, no matter how many cancellations occur when simplifying.
This is a consequence of unique factorization, which implies uniqueness of the lowest-terms representation of fractions. Suppose the real $\rm\,r\,$ has $\rm\:k\:$ nonzero digits after the decimal point. Then multiplying it by $\rm\,10^k$ shifts the decimal point right by $\rm\,k\,$ digits, hence yields an integer, i.e. $\rm\: 10^k r = n\in \Bbb Z.\:$ Thus $\rm\: r = n/10^k\:$ so canceling common factors to reduce this fraction to lowest terms yields a fraction whose denominator divides $\rm\:10^k\! = 2^k 5^k.\:$ By unique factorization the only such divisors are $\rm\:2^i 5^j\:$ for $\rm\:i,j \le k.\:$ Also by unique factorization the lowest terms representation of a fraction is unique, so there cannot exist another equivalent fraction in lowest terms whose denominator has prime factors other than $2$ and $5$. This completes the proof.