Okay I am weak in mathematics, I have no shame in saying that.
I am preparing for my internals and the concept of the GCD and LCM is quite confusing to me.
There is this question which is:
Find the largest 4 digit number that is exactly divisible by 12,15,18 and 27.
The solution is by finding out the LCM of these numbers. I mean why ?
Why is it not GCD? What is the difference between GCD and LCM?
I would really appreciate someone expalining it thoroughly. Please try to help me with this.
Thank you.
You want a number that is divisible by all of $( 12,15,18, 27)$, which means that your target number $N$ must be a multiple of each of those.
In order to be a multiple of all of those, it will also need to be a multiple of their least common multiple (which is perhaps less obvious). Basically the multiples align at zero, then align again each time another "LCM" has been accumulated. For this case, we need the greatest multiple of the LCM which is still less than $10000$, which is not hard once you have determined the LCM.
The greatest common divisor is less than (or equal to) all the numbers being considered, and to find other numbers that divide every one of a set of numbers you would need the divisors of the GCD.
The LCM and GCD are related when you are just referring to two numbers, $a,b$, by $\text{lcm}(a,b)\cdot \gcd(a,b) = ab$ - all the factors of the numbers which are excluded from the GCD must be included in the LCM.