pub trait Factorial {
    fn factorial(n: u64) -> Self;
}

Required Methods§

Implementations on Foreign Types§

Computes the factorial of a number.

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

$$ f(n) = n! = 1 \times 2 \times 3 \times \cdots \times n. $$

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

Worst-case complexity

Constant time and additional memory.

Panics

Panics if the output is too large to be represented.

Examples

See here.

Computes the factorial of a number.

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

$$ f(n) = n! = 1 \times 2 \times 3 \times \cdots \times n. $$

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

Worst-case complexity

Constant time and additional memory.

Panics

Panics if the output is too large to be represented.

Examples

See here.

Computes the factorial of a number.

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

$$ f(n) = n! = 1 \times 2 \times 3 \times \cdots \times n. $$

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

Worst-case complexity

Constant time and additional memory.

Panics

Panics if the output is too large to be represented.

Examples

See here.

Computes the factorial of a number.

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

$$ f(n) = n! = 1 \times 2 \times 3 \times \cdots \times n. $$

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

Worst-case complexity

Constant time and additional memory.

Panics

Panics if the output is too large to be represented.

Examples

See here.

Computes the factorial of a number.

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

$$ f(n) = n! = 1 \times 2 \times 3 \times \cdots \times n. $$

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

Worst-case complexity

Constant time and additional memory.

Panics

Panics if the output is too large to be represented.

Examples

See here.

Computes the factorial of a number.

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

$$ f(n) = n! = 1 \times 2 \times 3 \times \cdots \times n. $$

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

Worst-case complexity

Constant time and additional memory.

Panics

Panics if the output is too large to be represented.

Examples

See here.

Implementors§