Factorials and Binomial Coefficients
Source:R/factorials_and_binomial_coefficients.R
factorials_and_binomial_coefficients.Rd
Functions to compute factorials, double factorials, rising and falling factorials, and binomial coefficients.
Usage
factorial_boost(i)
unchecked_factorial(i)
max_factorial()
double_factorial(i)
rising_factorial(x, i)
falling_factorial(x, i)
binomial_coefficient(n, k)
Value
A single numeric value with the computed factorial, double factorial, rising factorial, falling factorial, or binomial coefficient.
See also
Boost Documentation for more details on the mathematical background.
Examples
# Factorial of 5
factorial_boost(5)
#> [1] 120
# Unchecked factorial of 5 (using table lookup)
unchecked_factorial(5)
#> [1] 120
# Maximum factorial value that can be computed
max_factorial()
#> [1] 170
# Double factorial of 6
double_factorial(6)
#> [1] 48
# Rising factorial of 3 with exponent 2
rising_factorial(3, 2)
#> [1] 12
# Falling factorial of 3 with exponent 2
falling_factorial(3, 2)
#> [1] 6
# Binomial coefficient "5 choose 2"
binomial_coefficient(5, 2)
#> [1] 10