New course! Every coder should learn Generative AI!
Try a free lesson0
How to define the least common multiple
2 Answers
+ 1
you can write a recusive function that returns the greatest common divisor using gcd(a,b)=gcd(a,b%a) and gcd(a,b)=gcd(b,a) and use the fact that a*b/gcd(a,b) = lcm(a,b)