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.
Asked
Active
Viewed 74 times
-2
-
The ideas behind the article cited by @dxiv need to be extended to the consideration of other bases, besides base $~10.~$ In base $~10,~$ a rational number will have an infinite decimal expansion if and only if, when the numerator and denominator are expressed in lowest terms, the prime factorization of the denominator contains prime factors other than the prime factors of $~10,~$ which are $~2~$ and $~5.$ ...see next comment – user2661923 Apr 13 '23 at 00:06
-
Suppose, for example that $~n~$ represents a positive integer, which, when expressed in base $~10~$ has a prime factorization of the form $~3^a \times 7^b.~$ Then, for example $~\dfrac{1}{n},~$ when expressed in base $~21~$ will have a finite decimal expression, while in base $~10,~$ the expression will have an infinite number of decimals. – user2661923 Apr 13 '23 at 00:09
-
It's unclear if you want $a/b$ terminating in all bases, or if you are asking for a fixed $N.$ – Thomas Andrews Apr 13 '23 at 00:34
-
a/b terminating or repeating in any integer base N – ProgrammerInProgress Apr 14 '23 at 23:20
1 Answers
0
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.
-
I suspect "same" may confuse here. $5$ does not have the same prime factors as $10$ but all the distinct prime factors of $5$ are among the distinct prime factors of $10$. You may also want your fraction in lowest terms as $\frac{12}{60}$ does terminate in decimal even though $3$ is a factor of $60$ but not of $10$. And then there is the issue that $\frac15=0.2=0.199999\ldots$ so can be both terminating and recurring – Henry Apr 13 '23 at 00:54