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.