Base class of factoring methods.
All methods defined in factor.methods are implemented as
derived classes of this class. The main method factor is the only method user will call. Other methods continue_factor, find and generate are explained for a writer of a new factoring method.
Create an instance.
Factor the given positive integer number.
The default returned type is a list of tuples. Each tuple has
a factor and its valuation, and the product is equal to the
given number. It looks like:
[(p1, e1), ..., (pn, en)].
An option 'return_type' is for the returned type, whose value can be:
An option 'need_sort' is boolean: True to sort the result. This should be specified with return_type='list'.
Continue factoring and return the result of factorization.
The argument tracker should be an instance of FactoringInteger.
The default returned type is FactoringInteger, but if
'return_type' is specified as 'list' then it returns
list of tuples (prime, index).
The primes are judged by a function specified in 'primeq'
optional argument, default to nzmath.prime.primeq.
Find a factor from the target number.
This method must be overridden, or factor method should be overridden not to call this method.
Generate prime factors of the target number with their valuations. The method may terminate with yielding (1, 1) to indicate the factorization is incomplete.
This method must be overridden, or factor method should be
overridden not to call this method.
(new in 0.90.0)