text: public static BigInteger factorial(int n){if (n == 0 || n < 0){return BigInteger.One;}if (cache.ContainsKey(n)){return cache[(n)];}BigInteger result = BigInteger.ValueOf(n).Multiply(factorial(n - 2));cache.Add(n, result);return result;}