SOURCE

//  最大公约数
const gcd = (a, b) => {
    if (a < b) [b, a] = [a, b];
    if (a % b === 0) return b;
    return gcd(b, a % b)
};
console.log(gcd(1652, 2019));

//  最小公倍数
const lcm = (a, b) => {
    if (a === 0 || b === 0) return 0;
    return Math.abs(a * b) / gcd(a, b);
};
console.log(lcm(52, 20))

//  乘阶
const multiplication = (n) => {
    let m = 1;
    if (n < m) return n;
    for (let i = 0; i < n; i++) {
        m *= (n - i);
    }
    return m
}
console.log(multiplication(6))
console 命令行工具 X clear

                    
>
console