Least common multiple for 3 or more numbers
Posted
by paan
on Stack Overflow
See other posts from Stack Overflow
or by paan
Published on 2008-09-29T04:33:16Z
Indexed on
2010/04/14
21:53 UTC
Read the original article
Hit count: 235
How do you calculate the least common multiple of multiple numbers?
So far I've only been able to calculate it between two numbers. But have no idea how to expand it to calculate 3 or more numbers.
So far this is how I did it
LCM = num1 * num2 / gcd ( num1 , num2 )
With gcd is the function to calculate the greatest common divisor for the numbers. Using euclidean algorithm
But I can't figure out how to calculate it for 3 or more numbers.
© Stack Overflow or respective owner