Big Integer Factorials

''Generates n! up to about 20000 (after that, give or take, it will TLE). Runs in O(n), but is very slow because of the length of the string n!.''

Java
// import java.math.* ; BigInteger[] arr = new BigInteger[20001] ; arr[0] = BigInteger.ONE ; for (int i = 1 ; i &lt;= 20000 ; i ++) {    arr[i] = arr[i-1].multiply(BigInteger.valueOf(i)) ; } // To print values to the screen int N = 5 ; System.out.println(arr[N]) ; // Prints 120