PlanttPastes

project euler 5

Jun 25th, 2026
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const gcd = (a, b) => b ? gcd(b, a % b) : a;
  2. const lcm = (a, b) => a * b / gcd(a, b);
  3. let r = 1;
  4. for (let i = 2; i < 21; i++) r = lcm(r, i);
  5. console.log(r);
Advertisement
Add Comment
Please, Sign In to add comment