(a: bigint, b: bigint)
| 2 | import { bigPrimeFactors } from './primes.js'; |
| 3 | |
| 4 | export function gcd(a: bigint, b: bigint): bigint { |
| 5 | while (b !== BigInt(0)) [a, b] = [b, a % b]; |
| 6 | return a < 0 ? -a : a; |
| 7 | } |
| 8 | |
| 9 | export function lcm(a: bigint, b: bigint): bigint { |
| 10 | // `lcm(0, n) = 0`: the general formula would divide by `gcd(0, 0) = 0`. |
no outgoing calls
no test coverage detected