Get the greatest common devisor of two numbers
npm install @knutkirkhorn/gcd
import gcd from '@knutkirkhorn/gcd';
console.log(gcd(28, 2));
// => 2
Returns the gcd of number1
and number2
.
The gcd is computed using the Euclidean algorithm.
- @knutkirkhorn/gcd-cli - CLI for this module