IntegerPrimality

Works with JDK 1.1 and forward


Pretty straight forward class that creates data file containing information of primality of numbers between 0 and 2147483647 (integer max value). It might take few hours, but it need to be done only once. Data is packed to one bit per number. After that, same class can be used load that data file and then check primality of numbers in that range in practically zero time.

Useful for any programs that need to continuously check primality of rather small (~2 billion) numbers. This class was for example used when searching prime repeating polynomials (external link).


Source

IntegerPrimality.java (as .txt)