Skip to main content

Function: gcd()

gcd(a, b, timeoutMs?, startTime?): number

Defined in: utils/utils.ts:440

in connection with lcm, the gcd (greatest common divisor) determines the largest number that can divide into both inputs I used Eulers algorithm with Euclidan Divison for determining this. assumes non-zero inputs

Parameters​

a​

number

b​

number

timeoutMs?​

number

optional timeout in milliseconds. If provided and exceeded, returns -1

startTime?​

number

optional start time for timeout tracking (used internally for recursive calls)

Returns​

number