On cs.stackexchange I asked a math question: How to demonstrate only 4 numbers between two integers are multiples of .01 and also writable as binary.
Yuval Filmus answered with a explanation depending on knowledge that "a (reduced) rational number $p/q$ can be represented exactly in base $B$ if and only if all prime factors of $q$ are prime factors of $B$." I've tried googling to find how that's known and I've found a couple other posts that mention it as a known fact. It's not self-evident to me, should it be? Is it practical to demonstrate to someone with no background in number theory, or is it a theorem with a recognized name? Or just one of those things that's theorem 8.2 in one textbook and Theorem 24 in another?
I'm just asking out of curiosity - the original question arises in talking about why not to store currency in variables of type double in float.
Thanks
It is an immediate fact.
$\frac{p}{q} \times b^N$ is an integer $M$. Hence, $pb^N = q M$
Since $\gcd(p,q)=1$ (coprime), by Euclid's Lemma (or obviously) $q | b^N$.
So the prime factors of $q$ must be prime factors of $b$.