Well, sure, they’re never actually finite. So when do they stop repeating?
I’ve noticed that p/q has a terminating representation in base 10 only if 2 and 5 are the only primes that divide q. I strongly suspect that these are equivalent conditions, and that it’s no coincidence. I’m thinking that p/q will have a terminating representation in base n iff every prime [symbol]p[/symbol] that divides q also divides n.
Is this true? If so, how would I prove it? I’m not at all comfortable with number theory, so any answers will have to start at a halfway basic level.
Bah. I posted too fast. I just thought up what I think is a proof for the easy half. That is:
1/q terminates => the only prime divisors of q are 2 and 5.
For a real number R, the following are equivalent: “R’s base-10 representation terminates” and “There is some natural number N such that 10[sup]N[/sup]R is an integer”. I don’t think this statement requires much proof, do you?
Anyway, then, what we’re given is that there is some N such that 10[sup]N[/sup]/q is an integer, which we’ll call M. So 10[sup]N[/sup] = qM. Fundamental Theorem of Arithmetic. Blah blah blah. The only prime divisors of qM (and thus q) are 2 and 5.
Now, I’m not so sure about the other half. The part that says:
The only prime divisors of q are 2 and 5 => 1/q terminates.
However, I think it might not be so hard. Let’s see… If q = 2[sup]A[/sup]5[sup]B[/sup], then let M = 2[sup]B[/sup]5[sup]A[/sup], and then qM = 10[sup]A+B[/sup]. Letting N = A + B should do it. Though I’m not as sure about this half. What do you think?
PROPOSITION: Suppose m and n are coprime integers. Then the decimal representation of m/n terminates if and only if n is of the form 2[sup]a[/sup]5[sup]b[/sup].
Proof: If n = 2[sup]a[/sup]5[sup]b[/sup] then m/n = k/10[sup]r[/sup] for some integers k,r. For example if a>b,
m/n = 5[sup]a-b[/sup]m/10[sup]a[/sup]
Now it is clear that k/10[sup]r[/sup] is a terminating decimal.
Conversely, if m/n = N.a[sub]1[/sub]a[sub]2[/sub]…a[sub]M[/sub], then 10[sup]M[/sup]*(m/n) is an integer s. Then
m/n = s/10[sup]M[/sup] and, after cancellation, n is of the form 2[sup]a[/sup]5[sup]b[/sup].
Even better: you have that qM = 10[sup]A+B[/sup], so 1/q = M/10[sup]A+B[/sup]. That should be good enough–if two rationals are equal, then they have the same representation in base ten.
Okay. I am arguing that after we have cancelled the fraction s/10[sup]M[/sup] into its lowest terms the only prime factors in the denominator will be 2 or 5, since there is nowhere for any other factors to have come from. We can prove this formally:
PROPOSITION: Suppose a/b = m/n where a,b,m,n are integers and m,n are coprime ( so that the fraction m/n is in its lowest terms). Then for every prime p, if p divides n then p divides b ( so the only possible prime factors of n are the prime factors of b).
It will be helpful to prove first the
LEMMA: Suppose that p is prime and x,y are integers. Then if p divides the product xy, p divides either x or y.
Note that the assumption that p is prime is necessary here. Thus 6 divides 3*4 but does not divide either 3 or 4.
Proof: By unique prime factorization we can write x and y as products of primes. Then xy can be factorised as the factorization of x followed by the factorization of y and, again by UPF, this is the only possible factorization of xy. Now for every prime p, if p appears in the prime factorization of xy it must have apppeared in the factorization of either x or y ( by construction). Thus p divides x or p divides y, as claimed.
Proof of proposition: We have mb = na. Suppose p is prime and p divides n. Then certainly p divides na and thus p divides mb. By our lemma it follows that p divides m or p divides b. But m and n have no common factor greater than 1 and so ( since p divides n) it is imposssible that p should divide m. Thus p divides b and the proof is complete.