What is the most efficient way to calculate the least common multiple of two integers?
I just came up with this, but it definitely leaves something to be desired.
The most efficient way to calculate LCM - Time Complexity - O( log(min(a,b)) )
Fundamental Formula - LCM(a,b) = (a*b) / GCD(a,b)
The time comlexity of GCD(a,b) is O( log(min(a,b)) )
Here you can find the code in C, C++, C#, Python etc. click here
Thanks !