Definition and lemmas for gcd and lcm over Int
gcd #
Computes the greatest common divisor of two integers as a natural number. The GCD of two integers is
the largest natural number that evenly divides both. However, the GCD of a number and 0 is the
number's absolute value.
This implementation uses Nat.gcd, which is overridden in both the kernel and the compiler to
efficiently evaluate using arbitrary-precision arithmetic.
Examples:
Instances For
Represent a divisor of m * n as a product of a divisor of m and a divisor of n.
Equations
- One or more equations did not get rendered due to their size.
Instances For
lcm #
Computes the least common multiple of two integers as a natural number. The LCM of two integers is the smallest natural number that's evenly divisible by the absolute values of both.
Examples:
Int.lcm 9 6 = 18Int.lcm 9 (-6) = 18Int.lcm 9 3 = 9Int.lcm 9 (-3) = 9Int.lcm 0 3 = 0Int.lcm (-3) 0 = 0