📜  最大公约数递归 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:10.029000             🧑  作者: Mango

代码示例1
/* Function using "Euclidian Algorithm" to recursively find the 
greatest common divisor/factor (GCD/GCF) of 2 positive numbers*/
const gcf = function (small, large) {
    let r = large % small;
    if (r == 0)
        return small;
    else
        return gcf(r, small);
}