integer-gcd
▸ function gcdInt
(a
: number, b
: number): number
Defined in gcd/double/integer-gcd.ts:9
Computes the greatest common divisor of two integers a and b, using the Euclidean Algorithm.
precondition a, b must be integers
Parameters:
Name | Type |
---|---|
a | number |
b | number |
Returns: number
▸ function gcdInts
(vals
: number[]): number
Defined in gcd/double/integer-gcd.ts:85
Naively computes and returns the greatest common divisor of 2 or more integers by taking each integer in turn and calculating the GCD of that integer and the previously calculated GCD (where the first GCD is simply taken as the first number).
Parameters:
Name | Type | Description |
---|---|---|
vals | number[] | the integers for which the GCD is to be calculated |
Returns: number