Skip to content
Subhajit Sahu edited this page Aug 8, 2022 · 16 revisions

Find the least common multiple of numbers.

Similar: gcd, lcm.


function lcm(...xs)
// xs: a list of numbers

const xmath = require('extra-math');


xmath.lcm(2, 3);
// → 6

xmath.lcm(2, 3, 4);
// → 12

xmath.lcm(2, 3, 4, 5);
// → 60


References

Clone this wiki locally