pub trait Multifactorial {
    fn multifactorial(n: u64, m: u64) -> Self;
}

Required Methods§

Implementations on Foreign Types§

Computes a multifactorial of a number.

If the input is too large, the function panics. For a function that returns None instead, try checked_multifactorial.

$$ 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$.

$n!^{(m)} = O(\sqrt{n}(n/e)^{n/m})$.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if the output is too large to be represented.

Examples

See here.

Computes a multifactorial of a number.

If the input is too large, the function panics. For a function that returns None instead, try checked_multifactorial.

$$ 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$.

$n!^{(m)} = O(\sqrt{n}(n/e)^{n/m})$.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if the output is too large to be represented.

Examples

See here.

Computes a multifactorial of a number.

If the input is too large, the function panics. For a function that returns None instead, try checked_multifactorial.

$$ 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$.

$n!^{(m)} = O(\sqrt{n}(n/e)^{n/m})$.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if the output is too large to be represented.

Examples

See here.

Computes a multifactorial of a number.

If the input is too large, the function panics. For a function that returns None instead, try checked_multifactorial.

$$ 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$.

$n!^{(m)} = O(\sqrt{n}(n/e)^{n/m})$.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if the output is too large to be represented.

Examples

See here.

Computes a multifactorial of a number.

If the input is too large, the function panics. For a function that returns None instead, try checked_multifactorial.

$$ 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$.

$n!^{(m)} = O(\sqrt{n}(n/e)^{n/m})$.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if the output is too large to be represented.

Examples

See here.

Computes a multifactorial of a number.

If the input is too large, the function panics. For a function that returns None instead, try checked_multifactorial.

$$ 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$.

$n!^{(m)} = O(\sqrt{n}(n/e)^{n/m})$.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if the output is too large to be represented.

Examples

See here.

Implementors§