Skip to main content

Module gcd

Module gcd 

Source
Expand description

GCD and LCM (the spreadsheet GCD / LCM functions).

Functionsยง

gcd
The greatest common divisor of a and b (Euclid): it divides both, and every common divisor divides it. gcd(a, 0) == a, so folding from 0 gives the gcd of a list.
lcm_below
lcm(a, b) if it is below cap, else None. Positive a and b; the product is formed in u128, so the overflow check is exact: None exactly when the true lcm is at least cap. A result is a positive common multiple of a and b.