Determine whether the decimal expansion of a rational number is infinite

3.3k Views Asked by At

This may be a naive question but I would like to know whether we can determine if a fraction (say $1/3$) will produce a rational number with an infinite number of digits after the decimal when computed (without actually computing it).

Of course computers cannot store such rational numbers accurately and they are difficult to detect after calculations have been performed and the result truncated.

Similar to how we can perform integral calculations on improper fractions to get their remainder, I wonder if we can do something similar to determine if a proper fraction will compute to an irrational number.

2

There are 2 best solutions below

2
On BEST ANSWER

A rational number has terminating decimal expansion if the denominator (in lowest terms) has prime factors only $2$ or $5$ or both. Any other factors in the denominator yield a non-terminating decimal expansion.

Examples $$ \frac{1}{1024} = 0.0009765625\quad\text{(exactly)} $$ terminates because $1024 = 2^{10}$.

$$ \frac{1}{6} = 0.16666666666\cdots $$ is non-terminating, because $6=2\cdot3$ has a prime factor $3$.

4
On

An irrational number is one that cannot be written as a fraction. Examples are $\sqrt{2}$ and $\pi$.
Perhaps you mean the decimal stops, for example $3/4=0.75$. A fraction's decimal stops if the denominator is a power of $2$, (say 8), a power of $5$, (say 25), or their product, here 200.
Real numbers on computer are commonly stored in binary, which is base 2 instead of base ten. That is exact, and stops only if the denominator is a power of two.