Compute the greatest common divisor using Euclid's algorithm.
npm install @japan-d2/gcd
or
yarn add @japan-d2/gcd
import gcd from '@japan-d2/gcd'
console.log(gcd(721, 161))
7
Return the greatest common divisor of the integers a
and b
using Euclid's algorithm.
import gcd from '@japan-d2/gcd/lib/bigint'
console.log(gcd(721n, 161n))
7n
Return the greatest common divisor of the integers a
and b
using Euclid's algorithm.
MIT