FiSGO.PrimesHandler.prime_reconstructor
- prime_reconstructor(powers, leftover=1, primes_path='/home/docs/checkouts/readthedocs.org/user_builds/fisgo/checkouts/latest/FiSGO/PrecomputedData/BuiltinPrimes.txt')[source]
Given a list of integers ‘powers’, computes the product N of the first len(powers) primes raised to the integers of ‘powers’, returns N*leftover. By default, leftover is set to 1.
This function is intended to be used alongside
FiSGO.PrimesHandler.prime_scanner(), to reconstruct a partially factorized number. However, it is not necessary that leftover be coprime to N.This function uses PrimesHandler.primes to get the first len(powers) primes.
Example:
>>> prime_reconstructor([2,0,1], 7) 140 >>> prime_reconstructor(*prime_scanner(60, 4)) 60
- Parameters:
- Return type:
- Returns:
Integer, a reconstruction of an integer using powers as the prime exponents of the number, and multiplying the additional factor leftover.