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