In the equation a * b = c, given a, how can I find the lowest integer c provided that:
ais a terminating decimalbis an integer
Here is an example:
- a =
0.2525, b =400, c =101
I realize that I can multiply the decimal by 10^(decimal length) for primes, but how do I find the answer for non-primes? Am I overthinking this?
Simply write $a=\dfrac{c}{b}$ as an irreductible fraction, and this will give you the lowest integer $c$ and $b$.
Example: $a=0.2525=\dfrac{2525}{10000}=\dfrac{101}{400}$ yields $b=400$ and $c=101$. $c$ is minimal because $b,c$ are coprime integers.