Trait nekolib::math::lcm::Lcm

source ·
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);

Required Methods§

source

fn lcm(self, other: Self) -> Self

Implementations on Foreign Types§

source§

impl Lcm for isize

source§

fn lcm(self, other: Self) -> Self

source§

impl Lcm for i64

source§

fn lcm(self, other: Self) -> Self

source§

impl Lcm for u8

source§

fn lcm(self, other: Self) -> Self

source§

impl Lcm for usize

source§

fn lcm(self, other: Self) -> Self

source§

impl Lcm for i128

source§

fn lcm(self, other: Self) -> Self

source§

impl Lcm for u16

source§

fn lcm(self, other: Self) -> Self

source§

impl Lcm for i8

source§

fn lcm(self, other: Self) -> Self

source§

impl Lcm for i32

source§

fn lcm(self, other: Self) -> Self

source§

impl Lcm for u128

source§

fn lcm(self, other: Self) -> Self

source§

impl Lcm for u64

source§

fn lcm(self, other: Self) -> Self

source§

impl Lcm for i16

source§

fn lcm(self, other: Self) -> Self

source§

impl Lcm for u32

source§

fn lcm(self, other: Self) -> Self

Implementors§