compute Greatest Common Divisor (GCD)
npm install @japan-d2/gcdCompute the greatest common divisor using
Euclid's algorithm.
``bash`
npm install @japan-d2/gcd
or
`bash`
yarn add @japan-d2/gcd
`ts`
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.
`ts`
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