Class Hart_Fast
- java.lang.Object
-
- de.tilman_neumann.jml.factor.FactorAlgorithm
-
- de.tilman_neumann.jml.factor.hart.Hart_Fast
-
public class Hart_Fast extends FactorAlgorithm
Pretty simple yet fast variant of Hart's one line factorizer. The main problem with this implementation is that we need to know to nature of test numbers. With doTDivFirst=false it is the fastest algorithm for hard semiprimes, but if the test numbers contain factors < cbrt(N), it will fail to find some of them. With doTDivFirst=true it will find all factors of any kind of numbers, but not extraordinarily fast. Hart_TDiv_Race fixes that problem and is faster for test numbers that contain factors < cbrt(N).
-
-
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 Hart_Fast(boolean doTDivFirst)
Full constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
findSingleFactor(long N)
Find a factor of long N.BigInteger
findSingleFactor(BigInteger N)
Find a single factor of the given N, which is composite and odd.String
getName()
static void
main(String[] args)
Test.-
Methods inherited from class de.tilman_neumann.jml.factor.FactorAlgorithm
factor, factor, searchFactors
-
-
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getName
in classFactorAlgorithm
- Returns:
- The name of the algorithm, possibly including important parameters.
-
findSingleFactor
public BigInteger findSingleFactor(BigInteger N)
Description copied from class:FactorAlgorithm
Find a single factor of the given N, which is composite and odd.- Specified by:
findSingleFactor
in classFactorAlgorithm
- Returns:
- factor
-
findSingleFactor
public long findSingleFactor(long N)
Find a factor of long N.- Parameters:
N
-- Returns:
- factor of N
-
main
public static void main(String[] args)
Test.- Parameters:
args
- ignored
-
-