Level
프로그래머스 Lv2
Recruitment
function solution(arr) {
  const gcd = (a, b = 1) => {
    let r = a % b;
    while (b) {
      a = b;
      b = r;
      r = a % b;
    }
    return a;
  };

  return arr.reduce((accum, num, i) => (accum * num) / gcd(accum, num), arr[0]);
}