Class PrPTest
- java.lang.Object
-
- de.tilman_neumann.jml.primes.probable.PrPTest
-
public class PrPTest extends 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/.- Author:
- Tilman Neumann
-
-
Constructor Summary
Constructors Constructor Description PrPTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisProbablePrime(long N)booleanisProbablePrime(BigInteger N)BigIntegernextProbablePrime(BigInteger N)
-
-
-
Method Detail
-
isProbablePrime
public boolean isProbablePrime(long N)
-
isProbablePrime
public boolean isProbablePrime(BigInteger N)
-
nextProbablePrime
public BigInteger nextProbablePrime(BigInteger N)
- Parameters:
N-- Returns:
- first prime > N
-
-