Computes the factorial of a non-negative integer using memoization and BigInt.
Results are cached for performance and returned as BigInt for large values.
The non-negative integer or bigint to compute the factorial of.
The factorial of n as a BigInt.
n
factorial(5); // 120nfactorial(25n); // 15511210043330985984000000n Copy
factorial(5); // 120nfactorial(25n); // 15511210043330985984000000n
If n is negative or not an integer.
1.2.0
Computes the factorial of a non-negative integer using memoization and BigInt.
Results are cached for performance and returned as BigInt for large values.