Updated the README to show the new algorithms

This commit is contained in:
2019-03-02 19:34:42 -05:00
parent 00d8e71a88
commit 9b7765e21d

View File

@@ -14,3 +14,18 @@ Example of usage:
System.out.printf("It took %s to run this algorithm", timer.getStr()); System.out.printf("It took %s to run this algorithm", timer.getStr());
//You could also do something like this if you prefered //You could also do something like this if you prefered
System.out.printf("It took %f milliseconds to run this algorithm", timer.getMilli()); System.out.printf("It took %f milliseconds to run this algorithm", timer.getMilli());
#Algorithms
This is a class that contains many different algorithms that I have found it useful to keep around.
All algorithms are overloaded to allow for using both Integer and BigInteger types.
Examples of usage:
primes = getPrimes(topNum); //primes now holds all primes less than or equal to topNum
primes = getNumPrimes(numPrimes); //primes now holds an ArrayList containing the first numPrimes prime numbers
factors = getFactors(number); //factors now holds an ArrayList containing the factors of number
divisors = getDivisors(number); //divisors now holds an ArrayList containing all the divisors of number
fib = getFib(number); //fib now holds the number element in the fibonacci sequence
fib = getAllFib(highestNumber); //fib now holds an ArrayList containing all fibonacci numbers less than or equal to highestNumber
sum = getSum(numbers); //sum now holds the sum of all elements in the ArrayList numbers
sum = getBigSum(numbers): //Same as getSum, but for BigInteger
prod = getProd(numbers); //prod now holds the product of all elements in the ArrayList numbers
prod = getBigProd(numbers); //Same as getProd, but for BigInteger