Function aoc::util::lcm

source ·
pub fn lcm<T>(a: T, b: T) -> T
where T: PartialEq + Div<Output = T> + Mul<Output = T> + Rem<Output = T> + From<u8> + Copy,
Expand description

Compure the least common multiple.

The least common multiple is defined as the smallest possible integer that is divisible by both of two other integers.

Computes the least common multiple using the greatest common divisor.

§Example

assert_eq!(util::lcm(21, 6), 42);