JSFiddle - React, Tailwind, and code Playground
by wayne6172
JavaScript
function gcd(a, b){
if(b == 0)
return a;
return gcd(b, a % b);
}
// H(n) = H(n - 1) + H(n - 2);
// H(1) = 1, H(2) = 2;
console.log(gcd(6, 28));
/*
28,6 // 28 mod 6 = 4
4,6
4,2
0,2
*/