Class LucasTest
java.lang.Object
de.tilman_neumann.jml.primes.probable.LucasTest
public class LucasTest
extends java.lang.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.
-
Constructor Summary
Constructors Constructor Description LucasTest()
-
Method Summary
Modifier and Type Method Description boolean
isProbablePrime(java.math.BigInteger N)
(Non-strong) Lucas probable prime test with parameters P=1, D some value in 5, -7, 9, -11, 13, -15, ...boolean
isStrongProbablePrime(java.math.BigInteger N)
Strong Lucas probable prime test with parameters P=1, D some value in 5, -7, 9, -11, 13, -15, ...Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
LucasTest
public LucasTest()
-
-
Method Details
-
isProbablePrime
public boolean isProbablePrime(java.math.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(java.math.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
-