lcm

lcm(x, y)

Try it yourself:

See also:
gcd

lcm(): Least Common Multiple

lcm() returns the smallest positive integer divisible by each supplied integer. For example, lcm(6, 8) is 24. It is useful for synchronizing repeating cycles, finding a common denominator, and aligning periodic schedules.

Integer inputs

lcm is defined for integer-style values; fractional measurements should be converted to an appropriate integer representation first. The result is closely related to gcd(): for nonzero integers, lcm(a, b) × gcd(a, b) equals abs(a×b).

Use abs() when interpreting a magnitude, and rem() to verify divisibility. Large inputs can yield very large results, so avoid unnecessary conversion to floating-point values.

Try Lcm in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions