1: using Xint = System.Numerics.BigInteger;
2:
3:
4: namespace Luschny.Math.Factorial
5: {
6: public class FactorialProductNaive : IFactorialFunction
7: {
8: public FactorialProductNaive() { }
9:
10: public string Name
11: {
12: get { return "ProductNaive "; }
13: }
14:
15: public Xint Factorial(int n)
16: {
17: if (n < 0)
18: {
19: throw new System.ArgumentOutOfRangeException("n",
20: Name + ": n >= 0 required, but was " + n);
21: }
22:
23: Xint nFact = Xint.One;
24:
25: for (int i = 2; i <= n; i++)
26: {
27: nFact *= i;
28: }
29: return nFact;
30: }
31: }
32:
33: } // endOfProductNaive