Skip to content

Instantly share code, notes, and snippets.

@e-mihaylin
Created November 9, 2018 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e-mihaylin/9a488276bf5d47056f782f695377db20 to your computer and use it in GitHub Desktop.
Save e-mihaylin/9a488276bf5d47056f782f695377db20 to your computer and use it in GitHub Desktop.
const lcm = (...a) => {
const gcd = (a, b) => b === 0 ? a : gcd(b, a % b);
const lcm = (a, b) => a * b / gcd(a, b);
return a.reduce(lcm);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment