/// <summary> /// Main Thread /// </summary> static void Main() { Factorial.CalculateTermsUntilIndex(101); int solution = 0; for (int n = 1; n <= 100; n++) { for (int r = 1; r <= n; r++) { BigInteger product = 1; for (int j = 0; j < r; j++) { product *= (n - j); } BigInteger result = product / BigInteger.Parse(Factorial.GetFactorialTerm(r + 1)); if (result > 1000000) { solution++; } } } Console.WriteLine("Solution: {0}", solution); }
/// <summary> /// Main Thread /// </summary> static void Main() { Factorial.CalculateTermsUntilIndex(100); int result = (from c in Factorial.GetFactorialTerm(100).ToCharArray() select int.Parse(c.ToString())).Sum(); Console.WriteLine("Solution: {0}", result); }