up previous next
FactorINT    --    find prime factors of an integer


Syntax
FactorINT(N: INT): RECORD
FactorINT_TrialDiv(N: INT, MaxPrime: INT): RECORD
FactorINT_PollardRho(N: INT, Niters: INT): RECORD

Description
These functions find small (usually prime) factors of an integer. FactorINT may take a very long time, and may produce only a partial factorization! FactorINT_TrialDiv does trial division by all primes up to MaxPrime; be wary of giving large values for MaxPrime. FactorINT_PollardRho performs up to Niters iterations of the Pollard-Rho algorithm; the iterations stop as soon as a (non-trivial) factor is found. If no factor was found, the result is an empty factorization. Note that the factor found may not be prime! Be wary of specifying large values for Niters.

From version 5.0.4, to comply with the naming conventions, the fields are called factors and multiplicities instead of Factors and Exponents.

Example
/**/  FactorINT_TrialDiv(100,3);
record[factors := [2], multiplicities := [2], RemainingFactor := 25]

/**/  FactorINT(123456789);
record[factors := [3, 3607, 3803], multiplicities := [2, 1, 1], RemainingFactor := 1]

See Also