# Why are only fractions with denominator 2 and 5 non-repeating?

Given a rational number $\frac{n}{d}$, I understand that in the base $10$ number system, the number can be represented as a non-repeating decimal number if and only if $d$ has only prime factors of $2$ and $5$.

I have a hypothesis that the reason for this is because $2$ and $5$ are the prime factors of $10$, which is the base for our number system. So according to my hypothesis, on a base $6$ number system, a rational number could be represented as a non-repeating decimal if and only if the denominator's only prime factors are $2$ and $3$.

But this is just a hypothesis, I don't know exactly why it is true. I'm not sure what the connection is between the prime factors of the base, and whether or not a rational number will be a repeating decimal. Can someone demonstrate why this holds true?

-
This is true only after you reduce the fraction to the lowest term. Note that $\frac{3}{6}$ is finite. –  N. S. Jun 6 '13 at 14:24

If $b$ is the base, then a non repeating number $n/d$ is of the form $$\frac{n}{d}=\frac{a}{b^k}$$ where I assume that $n$ and $d$ have no common factors. Also we can assume $k>0$ or the fraction $n/d$ would already be an integer.

This means $$nb^k=ad.$$ If $p$ is a prime factor of $d$, then $p$ divides $nb^k$, but it can't divide $n$ so it must divide $b^k$, hence $b$.

Here I use the well known property of prime integers: if $p$ is prime and $p$ divides $xy$, then $p$ either divides $x$ or $y$.

-

Your hypothesis is true. In base $b$, the expansion of $\frac nd$ (with $n,d$ coprime) is terminating (i.e. ends in repeating $0$s) if and only if $b^k\cdot\frac nd$ is an integer for sufficiently large $k$ (take for $k$ the number of digits after the period). That is $d$ must divide $b^k$. This implies that $d$ must not have any prime divisor except those dividing $b$, and vice versa for such $d$ it is always possible to find suitable $k$.

-

Every rational number have form $\frac{n}{d}$, where $n$ and $d$ are coprimes. If you want to represent it as a decimal number you have to transform it to form $\frac{u}{10^v}$. $u$ is an integer when you multiply counter and denominator by the same integer. $d$ can be multiplied by some integer to form $10^v$ only if $d=2^{\alpha_2}\cdot 5^{\alpha_5}$.

-