Class TDiv
java.lang.Object
de.tilman_neumann.jml.factor.FactorAlgorithm
de.tilman_neumann.jml.factor.tdiv.TDiv
public class TDiv extends FactorAlgorithm
Trial division for large arguments.
-
Field Summary
Fields inherited from class de.tilman_neumann.jml.factor.FactorAlgorithm
NUM_PRIMES_FOR_31_BIT_TDIV, tdivLimit
-
Constructor Summary
Constructors Constructor Description TDiv()
-
Method Summary
Modifier and Type Method Description void
factor(java.math.BigInteger N, SortedMultiset<java.math.BigInteger> primeFactors)
Decomposes the argument N into prime factors.java.math.BigInteger
findSingleFactor(java.math.BigInteger N)
Find a single factor of the given N, which is composite and odd.java.lang.String
getName()
void
searchFactors(FactorArguments args, FactorResult result)
Tries to find small factors of a positive, possibly large argument N by doing trial division by all primes p <= pLimit.TDiv
setTestLimit(int pLimit)
Set the upper limit of primes to be tested.Methods inherited from class de.tilman_neumann.jml.factor.FactorAlgorithm
factor, getDefault
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
TDiv
public TDiv()
-
-
Method Details
-
getName
public java.lang.String getName()- Specified by:
getName
in classFactorAlgorithm
- Returns:
- The name of the algorithm, possibly including important parameters.
-
setTestLimit
Set the upper limit of primes to be tested.- Parameters:
pLimit
- upper limit of primes to be tested- Returns:
- this
-
factor
Description copied from class:FactorAlgorithm
Decomposes the argument N into prime factors.- Overrides:
factor
in classFactorAlgorithm
- Parameters:
N
- Number to factor.primeFactors
- a map to which found factors are added
-
searchFactors
Tries to find small factors of a positive, possibly large argument N by doing trial division by all primes p <= pLimit.- Overrides:
searchFactors
in classFactorAlgorithm
- Parameters:
args
-result
- a pre-initialized data structure to add results to
-
findSingleFactor
public java.math.BigInteger findSingleFactor(java.math.BigInteger N)Find a single factor of the given N, which is composite and odd. Very simple implementation just to complete the FactorAlgorithm interface.- Specified by:
findSingleFactor
in classFactorAlgorithm
- Parameters:
N
- number to be factored.- Returns:
- factor
-