Least Common Multiple

Find the least common multiple (LCM) of two numbers using the GCD-based formula.

Code

Algorithms
const gcd = (x, y) => y === 0 ? x : gcd(y, x % y);
return Math.abs(a * b) / gcd(a, b);

Parameters

First number

Second number

Browser·fetch() may be limited by CORS

More JavaScript Snippets