Trait malachite_base::num::arithmetic::traits::Lcm
source · [−]Expand description
Calculates the LCM (least common multiple) of two numbers.
Required Associated Types
Required Methods
Implementations on Foreign Types
sourceimpl Lcm<u8> for u8
impl Lcm<u8> for u8
sourcefn 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
sourceimpl Lcm<u16> for u16
impl Lcm<u16> for u16
sourcefn 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
sourceimpl Lcm<u32> for u32
impl Lcm<u32> for u32
sourcefn 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
sourceimpl Lcm<u64> for u64
impl Lcm<u64> for u64
sourcefn 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
sourceimpl Lcm<u128> for u128
impl Lcm<u128> for u128
sourcefn 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
sourceimpl Lcm<usize> for usize
impl Lcm<usize> for usize
sourcefn 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.