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 voidfactor(java.math.BigInteger N, SortedMultiset<java.math.BigInteger> primeFactors)Decomposes the argument N into prime factors.java.math.BigIntegerfindSingleFactor(java.math.BigInteger N)Find a single factor of the given N, which is composite and odd.java.lang.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, getDefaultMethods 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:
getNamein 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: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
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-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:
findSingleFactorin classFactorAlgorithm- Parameters:
N- number to be factored.- Returns:
- factor
-