Module malachite_base::num::arithmetic::lcm
source · Expand description
Lcm
, LcmAssign
, and CheckedLcm
,
traits for computing the LCM (least common multiple) of two numbers.
§lcm
use malachite_base::num::arithmetic::traits::Lcm;
assert_eq!(3u8.lcm(5), 15);
assert_eq!(12u16.lcm(90), 180);
§lcm_assign
use malachite_base::num::arithmetic::traits::LcmAssign;
let mut x = 3u8;
x.lcm_assign(5);
assert_eq!(x, 15);
let mut x = 12u16;
x.lcm_assign(90);
assert_eq!(x, 180);
§checked_lcm
use malachite_base::num::arithmetic::traits::CheckedLcm;
assert_eq!(3u8.checked_lcm(5), Some(15));
assert_eq!(12u16.checked_lcm(90), Some(180));
assert_eq!(120u8.checked_lcm(90), None);