Test of rational number as a terminating decimal number using $2^m \cdot 5^n$ I do not understand why $q$ needs to be equal to $2^m \times 5^n$ for $\frac{p}{q}$to be a terminating rational number.
Why cannot $q$ be equal to $2^m\times 3^n$?
Is there any documentation that I can read up on this?
 A: One definition we can use for a "terminating decimal" is that a number $x$ has a terminating decimal expansion if for some integer $n$, $x\cdot 10^n$ is an integer. In other words, if we can shift the decimal point a finite number of times to the right and end up nothing else after the decimal, that decimal expansion terminates.
For rational numbers ($x=\frac{p}{q}$, $p$ and $q$ are coprime), this means that we need $\frac{p\cdot10^n}{q}$ to be an integer. But since $p$ and $q$ are by definition coprime, this means that $q$ has to divide $10^n$ evenly. Looking at prime factorizations, $10^n=2^n5^n$, and $q$ must have a subset of these prime factors. Thus for the number to have a terminating decimal expansion, $q$ must be expressible as $2^{m_1}5^{m_2}$ for some $m_1,m_2<n$. But since $n$ can be arbitrarily large, this result holds for any integers $m_1,m_2$.

Notice that the allowable factors $2$ and $5$ for $q$ depend only on the prime factorization of $10$, the base in our decimal system. This has the consequence that in a different base system, you may have a different set of allowable factors for $q$. For example, in Base-12 ($12=2^23$), a rational number's "decimal" expansion terminates if $q=2^{m_1}3^{m_2}$. Likewise, in hexadecimal ($16=2^4$), a rational number terminates only if $q=2^m$.
