NZMATH
1.2.0
About: NZMATH is a Python based number theory oriented calculation system.
![]() ![]() |
Public Member Functions | |
def | __init__ (self, number) |
def | register (self, divisor, isprime=Unknown) |
def | replace (self, number, factors) |
def | getMatchingFactor (self, number) |
def | getCompositeFactor (self) |
def | getNextTarget (self, cond=None) |
def | getResult (self) |
def | setPrimality (self, number, isprime) |
def | sortFactors (self) |
Public Attributes | |
number | |
factors | |
primality | |
def nzmath.factor.util.FactoringInteger.__init__ | ( | self, | |
number | |||
) |
def nzmath.factor.util.FactoringInteger.getCompositeFactor | ( | self | ) |
Return a composite (or unknown primality) factor from factors in a form (base, index), whose base's primality is non-True. If there is no such factor, LookupError will be raised.
Definition at line 218 of file util.py.
References nzmath.factor.misc.FactoredInteger.factors, nzmath.factor.util.FactoringInteger.factors, and nzmath.factor.util.FactoringInteger.primality.
def nzmath.factor.util.FactoringInteger.getMatchingFactor | ( | self, | |
number | |||
) |
Find a factor matching to number.
Definition at line 208 of file util.py.
References nzmath.factor.misc.FactoredInteger.factors, and nzmath.factor.util.FactoringInteger.factors.
Referenced by nzmath.factor.util.FactoringInteger.replace().
def nzmath.factor.util.FactoringInteger.getNextTarget | ( | self, | |
cond = None |
|||
) |
Return the next target which meets 'cond'. if 'cond' is not specified, then the next target is a composite (or unknown primality) factor of self.number. 'cond' can be a binary (arguments are base and index) predicate. If there is no such factor, LookupError will be raised.
Definition at line 231 of file util.py.
References nzmath.factor.misc.FactoredInteger.factors, nzmath.factor.util.FactoringInteger.factors, and nzmath.factor.util.FactoringInteger.primality.
def nzmath.factor.util.FactoringInteger.getResult | ( | self | ) |
Return the factors in the form of [(base, index), ...].
Definition at line 248 of file util.py.
References nzmath.factor.misc.FactoredInteger.factors, and nzmath.factor.util.FactoringInteger.factors.
def nzmath.factor.util.FactoringInteger.register | ( | self, | |
divisor, | |||
isprime = Unknown |
|||
) |
Register a divisor of the number, if the divisor is a true divisor of the number. The number is divided by the divisor as many times as possible.
Definition at line 153 of file util.py.
References nzmath.factor.misc.FactoredInteger.factors, nzmath.factor.util.FactoringInteger.factors, nzmath.factor.util.FactoringInteger.primality, nzmath.factor.util.FactoringInteger.register(), nzmath.factor.util.FactoringInteger.replace(), and nzmath.factor.util.FactoringInteger.setPrimality().
Referenced by nzmath.factor.util.FactoringInteger.register().
def nzmath.factor.util.FactoringInteger.replace | ( | self, | |
number, | |||
factors | |||
) |
Replace a number with factors. The number is a one of known factors of tracked number. factors is a list of (base, index) pairs. It is assumed that number = product of factors.
Definition at line 185 of file util.py.
References nzmath.factor.misc.FactoredInteger.factors, nzmath.factor.util.FactoringInteger.factors, nzmath.factor.util.FactoringInteger.getMatchingFactor(), nzmath.factor.util.FactoringInteger.primality, and nzmath.factor.util.FactoringInteger.setPrimality().
Referenced by nzmath.factor.util.FactoringInteger.register().
def nzmath.factor.util.FactoringInteger.setPrimality | ( | self, | |
number, | |||
isprime | |||
) |
Set primality for number to isprime.
Definition at line 254 of file util.py.
References nzmath.factor.util.FactoringInteger.primality.
Referenced by nzmath.factor.util.FactoringInteger.register(), and nzmath.factor.util.FactoringInteger.replace().
def nzmath.factor.util.FactoringInteger.sortFactors | ( | self | ) |
Sort factors list. Return nothing.
Definition at line 260 of file util.py.
References nzmath.factor.misc.FactoredInteger.factors, and nzmath.factor.util.FactoringInteger.factors.
nzmath.factor.util.FactoringInteger.factors |
Definition at line 150 of file util.py.
Referenced by nzmath.prime.FactoredInteger.__iter__(), nzmath.prime.FactoredInteger.__mod__(), nzmath.prime.FactoredInteger.__mul__(), nzmath.prime.FactoredInteger.__pow__(), nzmath.prime.FactoredInteger.copy(), nzmath.prime.FactoredInteger.divisors(), nzmath.prime.FactoredInteger.exact_division(), nzmath.factor.util.FactoringInteger.getCompositeFactor(), nzmath.factor.util.FactoringInteger.getMatchingFactor(), nzmath.factor.util.FactoringInteger.getNextTarget(), nzmath.factor.util.FactoringInteger.getResult(), nzmath.prime.FactoredInteger.is_divisible_by(), nzmath.prime.FactoredInteger.prime_divisors(), nzmath.factor.util.FactoringInteger.register(), nzmath.factor.util.FactoringInteger.replace(), and nzmath.factor.util.FactoringInteger.sortFactors().
nzmath.factor.util.FactoringInteger.primality |
Definition at line 151 of file util.py.
Referenced by nzmath.factor.util.FactoringInteger.getCompositeFactor(), nzmath.factor.util.FactoringInteger.getNextTarget(), nzmath.factor.util.FactoringInteger.register(), nzmath.factor.util.FactoringInteger.replace(), and nzmath.factor.util.FactoringInteger.setPrimality().