How to prove a fraction $\frac{a}{b}$ is terminating or repeating in any base without dividing.

75 Views Asked by At

So, I would like to know how to know if fractions like $\frac{51632}{2345}$ or $\frac{6}{25}$ are terminating or repeating in any integer base $N$, not just limited to decimal, such as hexadecimal or binary, without having to compute it directly.

1

There are 1 best solutions below

1
On

You can do so by checking if the denominator's prime factorization consists of the same prime factors as the base you are using. For example, $\frac{1}{5}$ is terminating in base $10$, as $5$ is in the prime factorization of $10$, $5\cdot2$. However, in base $16$, $\frac{1}{5}$ would be repeating, as the prime factorization for $16$ is $2^4$, and so $5$ is not included in the prime factorization.

Generally, any number $\frac{a}{b}$ is terminating in integer base $N$ if the set of prime factors of $b$ is included in the set of prime factors of $N$.

However, if there is a faster way of doing so, you might want to post it here.