Euclidean gcd - Node.js Number

Node.js examples for Number:Algorithm

Description

Euclidean gcd

Demo Code

Math.gcd = function ( a, b ) {
    if ( !b ) {//from   w w  w .  j a  v a  2 s .com
        return a;
    }
    return this.gcd( b, a % b );
};

Related Tutorials