function gcd(a, b) {
  while (b !== 0) {
    let t = b;
    b = a % b;
    a = t;
  }
  return a;
}

function lcm(a, b) {
  let g = gcd(a, b);
  return (a / g) * b;
}
function solution(a, b) {
    const gcd = function(b, a) {
      const r = (b % a);
      return r ? gcd(a, r) : a;
    }

    return [gcd(b, a), ((b * a) / gcd(b, a))];
}
const gcd = (n, m) => {
  if (m === 0) return n;
  return gcd(m, n % m);
};

const lcm = (n, m) => (n * m) / gcd(n, m);