Class LucasTest
- java.lang.Object
-
- de.tilman_neumann.jml.primes.probable.LucasTest
-
public class LucasTest extends Object
Lucas probable prime tests. Both non-strong and strong variants are available. This implementation is inspired by [http://en.wikipedia.org/wiki/Baillie-PSW_primality_test] and references therein, as well as Java's built-in BigInteger.isProbablePrime() implementation. This implementation passes on preliminary trial division, because it is thought to be used in the "trial division" phase of the quadratic sieve on numbers that have already undergone quite a lot of trial divisions.- Author:
- Tilman Neumann
-
-
Constructor Summary
Constructors Constructor Description LucasTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isProbablePrime(BigInteger N)
(Non-strong) Lucas probable prime test with parameters P=1, D some value in 5, -7, 9, -11, 13, -15, ...boolean
isStrongProbablePrime(BigInteger N)
Strong Lucas probable prime test with parameters P=1, D some value in 5, -7, 9, -11, 13, -15, ...
-
-
-
Method Detail
-
isProbablePrime
public boolean isProbablePrime(BigInteger N)
(Non-strong) Lucas probable prime test with parameters P=1, D some value in 5, -7, 9, -11, 13, -15, ... and Q=(1-D)/4 in -1, 2, -2, 3, -3, ...- Parameters:
N
-- Returns:
- true if N is a Lucas probable prime, false if N is composite
-
isStrongProbablePrime
public boolean isStrongProbablePrime(BigInteger N)
Strong Lucas probable prime test with parameters P=1, D some value in 5, -7, 9, -11, 13, -15, ... and Q=(1-D)/4 in -1, 2, -2, 3, -3, ...- Parameters:
N
-- Returns:
- true if N is a strong Lucas probable prime, false if N is composite
-
-