public static BigInteger factorial(int n) {if (n == 0 || n < 0) {return BigInteger.ONE;}if (cache.containsKey(n))  {return cache.get(n);}BigInteger result = BigInteger.valueOf(n).multiply(factorial(n - 2));cache.put(n, result);return result;}

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;}
