Trait malachite_base::num::arithmetic::traits::CheckedMultifactorial
source · pub trait CheckedMultifactorial: Sized {
// Required method
fn checked_multifactorial(n: u64, m: u64) -> Option<Self>;
}
Expand description
Computes the $m$-multifactorial of a u64
, returning None
if the result is too large to be
represented. The $m$-multifactorial of a non-negative integer $n$ is the product of all integers
$k$ such that $0<k\leq n$ and $k\equiv n \pmod m$.
Required Methods§
fn checked_multifactorial(n: u64, m: u64) -> Option<Self>
Object Safety§
Implementations on Foreign Types§
source§impl CheckedMultifactorial for u8
impl CheckedMultifactorial for u8
source§fn checked_multifactorial(n: u64, m: u64) -> Option<u8>
fn checked_multifactorial(n: u64, m: u64) -> Option<u8>
Computes a multifactorial of a number.
If the input is too large, the function returns None
.
$$
f(n, m) = \begin{cases}
\operatorname{Some}(n!^{(m)}) & \text{if} \quad n!^{(m)} < 2^W, \\
\operatorname{None} & \text{if} \quad n!^{(m)} \geq 2^W,
\end{cases}
$$
where $W$ is Self::WIDTH
.
$n!^{(m)} = O(\sqrt{n}(n/e)^{n/m})$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl CheckedMultifactorial for u16
impl CheckedMultifactorial for u16
source§fn checked_multifactorial(n: u64, m: u64) -> Option<u16>
fn checked_multifactorial(n: u64, m: u64) -> Option<u16>
Computes a multifactorial of a number.
If the input is too large, the function returns None
.
$$
f(n, m) = \begin{cases}
\operatorname{Some}(n!^{(m)}) & \text{if} \quad n!^{(m)} < 2^W, \\
\operatorname{None} & \text{if} \quad n!^{(m)} \geq 2^W,
\end{cases}
$$
where $W$ is Self::WIDTH
.
$n!^{(m)} = O(\sqrt{n}(n/e)^{n/m})$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl CheckedMultifactorial for u32
impl CheckedMultifactorial for u32
source§fn checked_multifactorial(n: u64, m: u64) -> Option<u32>
fn checked_multifactorial(n: u64, m: u64) -> Option<u32>
Computes a multifactorial of a number.
If the input is too large, the function returns None
.
$$
f(n, m) = \begin{cases}
\operatorname{Some}(n!^{(m)}) & \text{if} \quad n!^{(m)} < 2^W, \\
\operatorname{None} & \text{if} \quad n!^{(m)} \geq 2^W,
\end{cases}
$$
where $W$ is Self::WIDTH
.
$n!^{(m)} = O(\sqrt{n}(n/e)^{n/m})$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl CheckedMultifactorial for u64
impl CheckedMultifactorial for u64
source§fn checked_multifactorial(n: u64, m: u64) -> Option<u64>
fn checked_multifactorial(n: u64, m: u64) -> Option<u64>
Computes a multifactorial of a number.
If the input is too large, the function returns None
.
$$
f(n, m) = \begin{cases}
\operatorname{Some}(n!^{(m)}) & \text{if} \quad n!^{(m)} < 2^W, \\
\operatorname{None} & \text{if} \quad n!^{(m)} \geq 2^W,
\end{cases}
$$
where $W$ is Self::WIDTH
.
$n!^{(m)} = O(\sqrt{n}(n/e)^{n/m})$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl CheckedMultifactorial for u128
impl CheckedMultifactorial for u128
source§fn checked_multifactorial(n: u64, m: u64) -> Option<u128>
fn checked_multifactorial(n: u64, m: u64) -> Option<u128>
Computes a multifactorial of a number.
If the input is too large, the function returns None
.
$$
f(n, m) = \begin{cases}
\operatorname{Some}(n!^{(m)}) & \text{if} \quad n!^{(m)} < 2^W, \\
\operatorname{None} & \text{if} \quad n!^{(m)} \geq 2^W,
\end{cases}
$$
where $W$ is Self::WIDTH
.
$n!^{(m)} = O(\sqrt{n}(n/e)^{n/m})$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl CheckedMultifactorial for usize
impl CheckedMultifactorial for usize
source§fn checked_multifactorial(n: u64, m: u64) -> Option<usize>
fn checked_multifactorial(n: u64, m: u64) -> Option<usize>
Computes a multifactorial of a number.
If the input is too large, the function returns None
.
$$
f(n, m) = \begin{cases}
\operatorname{Some}(n!^{(m)}) & \text{if} \quad n!^{(m)} < 2^W, \\
\operatorname{None} & \text{if} \quad n!^{(m)} \geq 2^W,
\end{cases}
$$
where $W$ is Self::WIDTH
.
$n!^{(m)} = O(\sqrt{n}(n/e)^{n/m})$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.