num/math_utils library

GCD, LCM, and related integer math.

Tree-shakeable: import only this file if you need these functions.

Functions

gcd(int a, int b) int
Greatest common divisor of a and b. Uses Euclidean algorithm.
lcm(int a, int b) int
Least common multiple. Returns 0 if either argument is 0.