numberlab 0.1.9

A collection of numerical algorithms
Documentation
/// Calculates the factorial (`n!`) of a given number `n`.
///
/// # Arguments
///
/// * `n` - A positive integer representing the number to calculate the factorial of.
///
/// # Examples
///
/// ```
/// use numberlab::formula::arithmetic::factorial;
///
/// let result = factorial(5);
/// assert_eq!(result, 120);
/// ```
pub fn factorial(n: u128) -> u128 {
    match n {
        0 => 1,
        _ => (1..=n).product(),
    }
}