info.mrupp.isoak1
Class Factorial

java.lang.Object
  extended by info.mrupp.isoak1.Factorial

public class Factorial
extends java.lang.Object

Precomputed factorial function. Returns the factorial n*(n-1)*...*1 of the input argument n. Implemented via tables for maximum speed. Runs in constant time.


Constructor Summary
Factorial()
          Provides precomputed results for the factorial function.
 
Method Summary
static int factorial(int n)
          Returns the factorial for arguments 0,1,...,12.
static long factorial(long n)
          Returns the factorial for arguments 0,1,...,20.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Factorial

public Factorial()
Provides precomputed results for the factorial function.

Method Detail

factorial

public static int factorial(int n)
Returns the factorial for arguments 0,1,...,12. Argument range is limited due to 13! being larger than the maximum integer.


factorial

public static long factorial(long n)
Returns the factorial for arguments 0,1,...,20. Argument range is limited due to 21! being larger than the maximum long integer.