RosettaCodeData/Task/Least-common-multiple/Maxima/least-common-multiple.maxima
2023-07-01 13:44:08 -04:00

6 lines
231 B
Text

lcm(a, b); /* a and b may be integers or polynomials */
/* In Maxima the gcd of two integers is always positive, and a * b = gcd(a, b) * lcm(a, b),
so the lcm may be negative. To get a positive lcm, simply do */
abs(lcm(a, b))