Trait malachite_base::num::arithmetic::traits::Multifactorial
source · [−]pub trait Multifactorial {
fn multifactorial(n: u64, m: u64) -> Self;
}
Required Methods
fn multifactorial(n: u64, m: u64) -> Self
Implementations on Foreign Types
sourceimpl Multifactorial for u8
impl Multifactorial for u8
sourcefn multifactorial(n: u64, m: u64) -> u8
fn multifactorial(n: u64, m: u64) -> u8
Computes a multifactorial of a number.
If the input is too large, the function panics. For a function that returns None
instead, try CheckedMultifactorial
.
$$ f(n, m) = n!^{(m)} = n \times (n - m) \times (n - 2m) \times \cdots \times i. $$ If $n$ is divisible by $m$, then $i$ is $m$; otherwise, $i$ is the remainder when $n$ is divided by $m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl Multifactorial for u16
impl Multifactorial for u16
sourcefn multifactorial(n: u64, m: u64) -> u16
fn multifactorial(n: u64, m: u64) -> u16
Computes a multifactorial of a number.
If the input is too large, the function panics. For a function that returns None
instead, try CheckedMultifactorial
.
$$ f(n, m) = n!^{(m)} = n \times (n - m) \times (n - 2m) \times \cdots \times i. $$ If $n$ is divisible by $m$, then $i$ is $m$; otherwise, $i$ is the remainder when $n$ is divided by $m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl Multifactorial for u32
impl Multifactorial for u32
sourcefn multifactorial(n: u64, m: u64) -> u32
fn multifactorial(n: u64, m: u64) -> u32
Computes a multifactorial of a number.
If the input is too large, the function panics. For a function that returns None
instead, try CheckedMultifactorial
.
$$ f(n, m) = n!^{(m)} = n \times (n - m) \times (n - 2m) \times \cdots \times i. $$ If $n$ is divisible by $m$, then $i$ is $m$; otherwise, $i$ is the remainder when $n$ is divided by $m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl Multifactorial for u64
impl Multifactorial for u64
sourcefn multifactorial(n: u64, m: u64) -> u64
fn multifactorial(n: u64, m: u64) -> u64
Computes a multifactorial of a number.
If the input is too large, the function panics. For a function that returns None
instead, try CheckedMultifactorial
.
$$ f(n, m) = n!^{(m)} = n \times (n - m) \times (n - 2m) \times \cdots \times i. $$ If $n$ is divisible by $m$, then $i$ is $m$; otherwise, $i$ is the remainder when $n$ is divided by $m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl Multifactorial for u128
impl Multifactorial for u128
sourcefn multifactorial(n: u64, m: u64) -> u128
fn multifactorial(n: u64, m: u64) -> u128
Computes a multifactorial of a number.
If the input is too large, the function panics. For a function that returns None
instead, try CheckedMultifactorial
.
$$ f(n, m) = n!^{(m)} = n \times (n - m) \times (n - 2m) \times \cdots \times i. $$ If $n$ is divisible by $m$, then $i$ is $m$; otherwise, $i$ is the remainder when $n$ is divided by $m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl Multifactorial for usize
impl Multifactorial for usize
sourcefn multifactorial(n: u64, m: u64) -> usize
fn multifactorial(n: u64, m: u64) -> usize
Computes a multifactorial of a number.
If the input is too large, the function panics. For a function that returns None
instead, try CheckedMultifactorial
.
$$ f(n, m) = n!^{(m)} = n \times (n - m) \times (n - 2m) \times \cdots \times i. $$ If $n$ is divisible by $m$, then $i$ is $m$; otherwise, $i$ is the remainder when $n$ is divided by $m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.