Package: effect
Module: BigInt
Determines the greatest common divisor of two bigints.
When to use
Use to compute the greatest common divisor of two integer values.
Example (Calculating greatest common divisors)
import { BigInt } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(BigInt.gcd(2n, 3n), 1n)
assert.deepStrictEqual(BigInt.gcd(2n, 4n), 2n)
assert.deepStrictEqual(BigInt.gcd(16n, 24n), 8n)
See
lcm for computing the least common multipleSignature
declare const gcd: { (that: bigint): (self: bigint) => bigint; (self: bigint, that: bigint): bigint; }
Since v2.0.0