Trait malachite_base::num::arithmetic::traits::Lcm
source · pub trait Lcm<RHS = Self> {
type Output;
// Required method
fn lcm(self, other: RHS) -> Self::Output;
}
Expand description
Calculates the LCM (least common multiple) of two numbers.
Required Associated Types§
Required Methods§
Implementations on Foreign Types§
source§impl Lcm for u8
impl Lcm for u8
source§fn lcm(self, other: u8) -> u8
fn lcm(self, other: u8) -> u8
Computes the LCM (least common multiple) of two numbers.
$$ f(x, y) = \operatorname{lcm}(x, y). $$
§Worst-case complexity
$T(n) = O(n^2)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is
max(self.significant_bits(), other.significant_bits())
.
§Panics
Panics if the result is too large to be represented.
§Examples
See here.
type Output = u8
source§impl Lcm for u16
impl Lcm for u16
source§fn lcm(self, other: u16) -> u16
fn lcm(self, other: u16) -> u16
Computes the LCM (least common multiple) of two numbers.
$$ f(x, y) = \operatorname{lcm}(x, y). $$
§Worst-case complexity
$T(n) = O(n^2)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is
max(self.significant_bits(), other.significant_bits())
.
§Panics
Panics if the result is too large to be represented.
§Examples
See here.
type Output = u16
source§impl Lcm for u32
impl Lcm for u32
source§fn lcm(self, other: u32) -> u32
fn lcm(self, other: u32) -> u32
Computes the LCM (least common multiple) of two numbers.
$$ f(x, y) = \operatorname{lcm}(x, y). $$
§Worst-case complexity
$T(n) = O(n^2)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is
max(self.significant_bits(), other.significant_bits())
.
§Panics
Panics if the result is too large to be represented.
§Examples
See here.
type Output = u32
source§impl Lcm for u64
impl Lcm for u64
source§fn lcm(self, other: u64) -> u64
fn lcm(self, other: u64) -> u64
Computes the LCM (least common multiple) of two numbers.
$$ f(x, y) = \operatorname{lcm}(x, y). $$
§Worst-case complexity
$T(n) = O(n^2)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is
max(self.significant_bits(), other.significant_bits())
.
§Panics
Panics if the result is too large to be represented.
§Examples
See here.
type Output = u64
source§impl Lcm for u128
impl Lcm for u128
source§fn lcm(self, other: u128) -> u128
fn lcm(self, other: u128) -> u128
Computes the LCM (least common multiple) of two numbers.
$$ f(x, y) = \operatorname{lcm}(x, y). $$
§Worst-case complexity
$T(n) = O(n^2)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is
max(self.significant_bits(), other.significant_bits())
.
§Panics
Panics if the result is too large to be represented.
§Examples
See here.
type Output = u128
source§impl Lcm for usize
impl Lcm for usize
source§fn lcm(self, other: usize) -> usize
fn lcm(self, other: usize) -> usize
Computes the LCM (least common multiple) of two numbers.
$$ f(x, y) = \operatorname{lcm}(x, y). $$
§Worst-case complexity
$T(n) = O(n^2)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is
max(self.significant_bits(), other.significant_bits())
.
§Panics
Panics if the result is too large to be represented.
§Examples
See here.