pub trait Lcm {
// Required method
fn lcm(self, other: Self) -> Self;
}
Expand description
最小公倍数。
Complexity
$O(\log(\min\{m, n\}))$ time.
Examples
use nekolib::math::Lcm;
assert_eq!(12_u32.lcm(18), 36);
assert_eq!(13_i32.lcm(-3), -39);
assert_eq!(60_u32.lcm(90).lcm(150), 900);
assert_eq!(0_u32.lcm(0), 0);
assert_eq!(0_u32.lcm(1), 0);