Class PrPTest
java.lang.Object
de.tilman_neumann.jml.primes.probable.PrPTest
public class PrPTest
extends java.lang.Object
A probable prime test for arbitrary precision numbers.
For N<32 bit it does trial division. Otherwise it checks the residues of N % 30030, and then
does a Miller-Rabin test with Sinclairs bases for N<64 bit, or a BPSW test for larger N.
Note that both the Sinclair-Miller-Rabin and BPSW test are considered deterministic prime tests for N<=2^64.
See http://en.wikipedia.org/wiki/Baillie-PSW_primality_test
and http://miller-rabin.appspot.com/.
-
Constructor Summary
Constructors Constructor Description PrPTest()
-
Method Summary
Modifier and Type Method Description boolean
isProbablePrime(long N)
boolean
isProbablePrime(java.math.BigInteger N)
java.math.BigInteger
nextProbablePrime(java.math.BigInteger N)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
PrPTest
public PrPTest()
-
-
Method Details
-
isProbablePrime
public boolean isProbablePrime(long N) -
isProbablePrime
public boolean isProbablePrime(java.math.BigInteger N) -
nextProbablePrime
public java.math.BigInteger nextProbablePrime(java.math.BigInteger N)- Parameters:
N
-- Returns:
- first prime > N
-