List of utility methods to do Factorial
long | factorial(int n) factorial return FACTORIALS[n];
|
int | factorial(int n) Returns n! int returnValue; if (n < 0) { throw new IllegalArgumentException("Illegal value: " + n); } else if ((n == 0) || (n == 1)) { returnValue = 1; } else { returnValue = n * factorial(n - 1); return returnValue; |
double | factorial(int n) factorial if (n < 0 || (n - (int) n) != 0) throw new IllegalArgumentException( "\nn must be a positive integer\nIs a Gamma funtion [gamma(x)] more appropriate?"); double f = 1.0D; for (int i = 1; i <= n; i++) f *= i; return f; |
double | factorial(int n) factorial return binomialCoefficient(n, 1);
|
int | factorial(int number) A trivial recursive calculation of a number\'s factorial if (number <= 1) { return 1; } else { return number * factorial(number - 1); |
int | factorial(int value) factorial if (value > 12) { throw new IllegalStateException("The value[" + value + "] is greater than 12 and anything equal to or larger than 13! is too large to be returned as an int."); } else if (value < 0) { throw new IllegalStateException( "The value[" + value + "] is less than 0, so factorial cannot be computed."); int result = 1; ... |
double | factorial(int x) factorial return Math.pow(10, log10Gamma(x + 1));
|
int | Factorial(int x) returns the factorial of a number if (x == 0 || x == 1) { return 1; } else if (x > 0) { int mul = 2; for (int i = 3; i <= x; i++) { mul *= i; return mul; ... |
long | factorial(int x) Calculates the factorial of x. long result = 1; while (x >= 1) { result *= x; x--; return result; |
long | factorial(long l) Simple method to calculate the factorial of small values. if (l <= 2) return l; return l * factorial(l - 1); |