up previous next
SmoothFactor

find small prime factors of an integer

Syntax
SmoothFactor(N:INT, MaxP:INT):RECORD[LIST of INT, INT]


Description
This function finds the small prime factors of an integer. It simply tries dividing by all primes up to the given bound MaxP . The result is a list of the prime factors found together with the unfactored part of N. Be careful about supplying large values for MaxP (e.g. greater than a million): the function could take a very long time. MaxP must be positive.

Example
/**/  SmoothFactor(100,3);
Record[Exponents := [2], Factors := [2], RemainingFactor := 25]

/**/  SmoothFactor(123456789,3700);
Record[Exponents := [2, 1], Factors := [3, 3607], RemainingFactor := 3803]


See Also