You are viewing a single comment's thread. Return to all comments →
"Count the number of multiples of LCM that evenly divides the GCD." is the same as "Cound the divisors of (GCD/LCM)"
This will make the loop much easier.
Also notice that if (GCD/LCM) is not in integer, the result is 0.
How exactly is one different from the other?
My approach was as follows:
your modification to the above said approach will give wrong answer. as all mulitples of lcm will not evenly divide the gcd. so you will have to check each multiple individually.