pub trait CheckedDoubleFactorial: Sized {
    fn checked_double_factorial(n: u64) -> Option<Self>;
}

Required Methods§

Implementations on Foreign Types§

Computes the double factorial of a number.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(n!!) & \text{if} \quad n!! < 2^W, \\ \operatorname{None} & \text{if} \quad n!! \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

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

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the double factorial of a number.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(n!!) & \text{if} \quad n!! < 2^W, \\ \operatorname{None} & \text{if} \quad n!! \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

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

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the double factorial of a number.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(n!!) & \text{if} \quad n!! < 2^W, \\ \operatorname{None} & \text{if} \quad n!! \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

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

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the double factorial of a number.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(n!!) & \text{if} \quad n!! < 2^W, \\ \operatorname{None} & \text{if} \quad n!! \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

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

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the double factorial of a number.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(n!!) & \text{if} \quad n!! < 2^W, \\ \operatorname{None} & \text{if} \quad n!! \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

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

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the double factorial of a usize.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(n!!) & \text{if} \quad n!! < 2^W, \\ \operatorname{None} & \text{if} \quad n!! \geq 2^W, \end{cases} $$ where $W$ is usize::WIDTH.

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

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Implementors§