How to define the least common multiple | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to define the least common multiple

4th Jun 2018, 10:19 AM
Mirobidjon Ismonov
Mirobidjon Ismonov - avatar
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)
4th Jun 2018, 10:51 AM
Max
Max - avatar
4th Jun 2018, 10:29 AM
Ulisses Cruz
Ulisses Cruz - avatar