Calculates the factorial for positive integers.
FACTORIAL(n)
n |
- |
A scalar or series. Must contain integer values |
A scalar or series.
factorial(6)
returns 720.
W1: 0..10
W2: factorial(W1)
W2 == {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800}
For integer n, FACTORIAL returns the product of all integer values 1..n, thus:
factorial(n) == prod(1..n)
For a series, FACTORIAL returns the factorial for each element.
Using double precision accuracy, FACTORIAL is precise up to n == 21 and will retain 15 digits of accuracy for n > 21
See GAMMA for a generalized factorial function that operates on real or complex input values.