/// <summary>Calculates the number of ways that a number of items may be permuted, which is equal to its factorial.</summary> public static Integer CountPermutations(int n) { if (n < 1) { throw new ArgumentOutOfRangeException(); } return(Integer.Factorial(n)); }
public ICalculonType Execute(ref ControllerState cs) { Integer input = (Integer)cs.stack.Pop(); if (input.data < 0) { cs.stack.Push(input); return(new ErrorType(cs.Config.strings["FactorialNeg"])); } return(input.Factorial()); }