RosettaCodeData/Task/Least-common-multiple/Maxima/least-common-multiple.maxima

7 lines
231 B
Plaintext

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))