Class 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 Detail

      • PrPTest

        public PrPTest()
    • 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