org.jquantlib.math
Class PrimeNumbers
- java.lang.Object
-
- org.jquantlib.math.PrimeNumbers
-
public class PrimeNumbers extends java.lang.ObjectThis class creates an ArrayList of prime numbers, stored as long. This class is 'bootstrapped', and longs are calculated on demand. Therefore, if a time senstitve aspect of the application requires the quick retrieval of a prime, this array should be pre-fetched and populated before that quick need arises.
Once a prime has been calculated, it will be stored for the life of the JVM.
ALGO: The algorithm used from QuantLib is not very efficient, because it skips only multiples of 2, and checks each number after that. really, it could also skip multiples of 3,5,7,etc... In ohter words once a prime has been calculated, you can just skip over that multiple too. // TODO fill in a latex algo for later.
-
-
Constructor Summary
Constructors Constructor and Description PrimeNumbers()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description longget(int absoluteIndex)longnextPrimeNumber()
-
DataMelt 3.0 © DataMelt by jWork.ORG