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 voidfactor(BigInteger N, SortedMultiset<BigInteger> primeFactors)Decomposes the argument N into prime factors.BigIntegerfindSingleFactor(BigInteger N)Find a single factor of the given N, which is composite and odd.StringgetName()voidsearchFactors(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.TDivsetTestLimit(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:
getNamein 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:FactorAlgorithmDecomposes the argument N into prime factors.- Overrides:
factorin 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:
searchFactorsin 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:
findSingleFactorin classFactorAlgorithm- Returns:
- factor
-
-