# Detecting that a fraction is a repeating decimal

Given any fraction where both the numerator (N) and denominator (D) are both positive and are both whole numbers.

Without manually dividing N by D, is it possible to pre-determine if the resulting value represented in decimal would be a repeating value? (e.g. 44÷33 is 1.3333333333....)

I believe the value of N ÷ D will NOT be a repeating decimal if and only if D is any of the following

1. D is equal to 1 OR
2. D's prime factors only consist of 2's and/or 5's. (includes all multiples of 10)

Otherwise, if none of the two rules above hold true, then the positive whole numbers N and D will divide into repeating decimal.

Correct, or am I missing a case?

-
To be pedantic, you are missing the case where $N/D$ is not in lowest terms (e.g. $N=D=3$) –  Ben Millwood Sep 16 '12 at 10:53
More generally, in base $N$, if $d_i\mid N$, then $\frac{N}{\prod d_i^{r_i}}$ is terminating in base $N$. –  lab bhattacharjee Sep 16 '12 at 10:57
@labbhattacharjee: I assume you didn't mean to use the same letter for your base and your numerator –  Ben Millwood Sep 16 '12 at 11:39
@Ben: That is useful and necessary pedantry, since the OP's main example is $44/33$, which is not in lowest terms. As a counterexample, $6/15=0.4$ is terminating even though $15$ has a prime factor ($3$) that is neither $2$ nor $5$. –  Henning Makholm Sep 16 '12 at 12:29
@BenMillwood, ya,sorry for the mistyping. The rectified version : in base $B$, if $d_i\mid B$, then $\frac{N}{\prod d_i^{r_i}}$ is terminating in base $B$. –  lab bhattacharjee Sep 16 '12 at 14:53

Correct.

From wikipedia:

A decimal representation written with a repeating final 0 is said to terminate before these zeros. Instead of "1.585000…" one simply writes "1.585". The decimal is also called a terminating decimal. Terminating decimals represent rational numbers of the form $k/(2^n5^m)$.

http://en.wikipedia.org/wiki/Repeating_decimals

-
I've edited this to correct the ways in which it was untidy and just plain misleading – when you copy and paste from wikipedia, you should at least read over the preview of what you've pasted, and notice that you've left in a [1] that serves no purpose and the superscripts haven't copied properly. –  Ben Millwood Sep 16 '12 at 11:44
How was it just plain misleading if I left a superscript that was obviously copied over? I could care less if people knew that the original content was cited, I just left it there. –  JasonSage Sep 16 '12 at 11:51
I was referring to the superscripts in k/(2n5m). Sorry that wasn't clear. –  Ben Millwood Sep 16 '12 at 11:58
Ah, I see I neglected that. Thanks! ;) –  JasonSage Sep 16 '12 at 11:59

Decimals of fractions are always eventually periodic (eventually because e.g. $\frac1{300}=0.00\overline 3$, i.e. the period need not start immediately). Your exceptions only summarize the cases when the period consists of zeroes (and hence can be left out for convenience), e.g. $\frac18=0.125\overline0$. This will happen iff multiplication by a suitable power of ten makes the fraction an integer, i.e. if the denominator contains only 2's and 5's, as you correctly state.

-
I thought about this and I see no reason why we should consider $0.125$ to be "really" $0.125\overline 0$. One might as well say that $1$ is actually $\overline 01$. –  Ben Millwood Sep 16 '12 at 11:41
(I'm not the downvoter, though) –  Ben Millwood Sep 16 '12 at 11:43
$0.125$ is not "really" $0.125\overline0$ (nor is it "really" $0.124\overline9$). Both (all three) are representations of a number that when doubled and doubled and doubled again produces the neutral element of multiplication. However, it is technically much easier to say that "$x=\sum_{n=-k}^\infty d_n10^{-n}$ with $d_n\in\{0, \ldots,9\}$" than to say that "either $x=\sum_{n=-k}^\infty d_n10^{-n}$ with $d_n\in\{0, \ldots,9\}$ for $n\ge-k$ and $d_n\ne0$ for infinitely many $n$ or $x=\sum_{n=-k}^m d_n10^{-n}$ with $d_n\in\{0, \ldots,9\}$ for $-k\le n\le m$ and $m=0$ or $d_m\ne0$". –  Hagen von Eitzen Sep 16 '12 at 12:14
@Ben: No, $\overline{0}1$ and $0.125\overline{0}$ are not comparable: the latter is a special case of a general type, but the former is not, since we do not, for example, have an integer $\overline{1}$. –  Brian M. Scott Sep 16 '12 at 21:53
Yeah, I suppose that's a fair point, on both counts. I don't, however, think that the statement "a terminating decimal consists of only finitely many digits" is an unreasonable one - the interpretation in which it's true may be slightly more complicated than the one in which it isn't, but both are valid and arguably one is less inclined to throw about infinities and limits where they aren't required. –  Ben Millwood Sep 17 '12 at 0:16

There is a way to do this. You carry out the long division so as to produce remainder ratios and it either terminates or you get a ratio you've had before, in which case the expansion is repeating. Proof that every repeating decimal is rational

-