Class 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).
    • Constructor Detail

      • Hart_Fast

        public Hart_Fast​(boolean doTDivFirst)
        Full constructor.
        Parameters:
        doTDivFirst - If true then trial division is done before the Lehman loop. This is recommended if arguments N are known to have factors < cbrt(N) frequently.
    • Method Detail

      • getName

        public String getName()
        Specified by:
        getName in class FactorAlgorithm
        Returns:
        The name of the algorithm, possibly including important parameters.
      • 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