Hacker News new | ask | show | jobs
by 7x11x13 1467 days ago
> it can only express fractions that use a prime factor of the base.

IMO it could do better to explain why this is the case rather than state it as a fact, as it’s not immediately obviously true (at least to me).

A terminating decimal is equivalent to a fraction with a denominator that is a power of 10. Any fraction with a denominator that is a product of prime factors of 10 can be turned into a fraction with a denominator that is a power of 10. Thus the only fractions with terminating decimal representations are those with denominators which are a product of prime factors of 10.

Of course this is true for any base other than 10, but I couldn’t think of a term for “terminating decimal” with other bases.

1 comments

That’s not a very good explanation. That second sentence

> Any fraction with a denominator that is a product of prime factors of 10 can be turned into a fraction with a denominator that is a power of 10.

isn’t sufficient. You also have to argue that any fraction with a denominator that is not a product of the prime factors of 10 cannot be written as a finite decimal.

If you do that you end up with a tautology.

A better and more rigid explanation would start with a rational p/q, with p and q relatively prime that can be written as some integer divided by 10^n, and reason from there.

I don't think you're being charitable here. Sure, their explanation wasn't perfect, but their line of reasoning was absolutely on point.

You almost gave a really good explanation yourself on why this should be the case but stopped short of it. Don't know why. Any terminating decimal can be written in the form a/10^{n} where a and n are both integers. After we have our p/q, there exists an integer c such that p/q · c/c = p/10^{n} if and only if q consists solely of the primes 2 or 5 (or both). And if not, then there isn't an integer c to satisfy said condition, thus making it impossible to write our p/q in the form of a/10^{n} (white still keeping the numerator an integer at least) so it's an infinitely repeating decimal.

You're right, my explanation was invalid.