How to define the least common multiple | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

How to define the least common multiple

4th Jun 2018, 10:19 AM
Mirobidjon Ismonov
Mirobidjon Ismonov - avatar
2 Respuestas
+ 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