Trait malachite_base::num::arithmetic::traits::Factorial
source · [−]Required Methods
Implementations on Foreign Types
sourceimpl Factorial for u8
impl Factorial for u8
sourcefn factorial(n: u64) -> u8
fn factorial(n: u64) -> u8
Computes the factorial of a number.
If the input is too large, the function panics. For a function that returns None
instead, try CheckedFactorial
.
$$ f(n) = n! = 1 \times 2 \times 3 \times \cdots \times n. $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl Factorial for u16
impl Factorial for u16
sourcefn factorial(n: u64) -> u16
fn factorial(n: u64) -> u16
Computes the factorial of a number.
If the input is too large, the function panics. For a function that returns None
instead, try CheckedFactorial
.
$$ f(n) = n! = 1 \times 2 \times 3 \times \cdots \times n. $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl Factorial for u32
impl Factorial for u32
sourcefn factorial(n: u64) -> u32
fn factorial(n: u64) -> u32
Computes the factorial of a number.
If the input is too large, the function panics. For a function that returns None
instead, try CheckedFactorial
.
$$ f(n) = n! = 1 \times 2 \times 3 \times \cdots \times n. $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl Factorial for u64
impl Factorial for u64
sourcefn factorial(n: u64) -> u64
fn factorial(n: u64) -> u64
Computes the factorial of a number.
If the input is too large, the function panics. For a function that returns None
instead, try CheckedFactorial
.
$$ f(n) = n! = 1 \times 2 \times 3 \times \cdots \times n. $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl Factorial for u128
impl Factorial for u128
sourcefn factorial(n: u64) -> u128
fn factorial(n: u64) -> u128
Computes the factorial of a number.
If the input is too large, the function panics. For a function that returns None
instead, try CheckedFactorial
.
$$ f(n) = n! = 1 \times 2 \times 3 \times \cdots \times n. $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl Factorial for usize
impl Factorial for usize
sourcefn factorial(n: u64) -> usize
fn factorial(n: u64) -> usize
Computes the factorial of a number.
If the input is too large, the function panics. For a function that returns None
instead, try CheckedFactorial
.
$$ f(n) = n! = 1 \times 2 \times 3 \times \cdots \times n. $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.