LCM
Returns the least common multiple of two or more numbers.
- Define a
gcd()function that determines the greatest common divisor, using recursion. - Use
gcd()and the fact thatLCM(x, y) = x * y / GCD(x,y)to determine the least common multiple. - Use
rangeto apply the calculation to all given numbers.