1:  using Xint = System.Numerics.BigInteger;
   2:   
   3:   
   4:  namespace Luschny.Math.Factorial
   5:  {
   6:      public class FactorialProductRecursive : IFactorialFunction
   7:      {
   8:          public FactorialProductRecursive() { }
   9:   
  10:          public string Name
  11:          {
  12:              get { return "ProductRecursive    "; }
  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:              if (1 < n)
  24:              {
  25:                  return RecProduct(1, n);
  26:              }
  27:   
  28:              return Xint.One;
  29:          }
  30:   
  31:          private Xint RecProduct(int n, int len)
  32:          {
  33:              if (1 < len)
  34:              {
  35:                  int l = len >> 1;
  36:                  return RecProduct(n, l) * RecProduct(n + l, len - l);
  37:              }
  38:   
  39:              return new Xint(n);
  40:          }
  41:      }
  42:  }   // endOfFactorialProductRecursive