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.- Author:
- Tilman Neumann
-
-
Field Summary
-
Fields inherited from class de.tilman_neumann.jml.factor.FactorAlgorithm
DEFAULT, NUM_PRIMES_FOR_31_BIT_TDIV, tdivLimit
-
-
Constructor Summary
Constructors Constructor Description TDiv()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
factor(BigInteger N, SortedMultiset<BigInteger> primeFactors)
Decomposes the argument N into prime factors.BigInteger
findSingleFactor(BigInteger N)
Find a single factor of the given N, which is composite and odd.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
-
-
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getName
in classFactorAlgorithm
- Returns:
- The name of the algorithm, possibly including important parameters.
-
setTestLimit
public TDiv setTestLimit(int pLimit)
Set the upper limit of primes to be tested.- Parameters:
pLimit
-- Returns:
- this
-
factor
public void factor(BigInteger N, SortedMultiset<BigInteger> primeFactors)
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
public 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.- Overrides:
searchFactors
in classFactorAlgorithm
- Parameters:
args
-result
- a pre-initalized data structure to add results to
-
findSingleFactor
public BigInteger findSingleFactor(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
- Returns:
- factor
-
-