Answers for "find all divisors of a number python"

0

find all divisors of a number python

def divisorGen(n):
    factors = list(factorGenerator(n))
    nfactors = len(factors)
    f = [0] * nfactors
    while True:
        yield reduce(lambda x, y: x*y, [factors[x][0]**f[x] for x in range(nfactors)], 1)
        i = 0
        while True:
            f[i] += 1
            if f[i] <= factors[i][1]:
                break
            f[i] = 0
            i += 1
            if i >= nfactors:
                return
              
# Excerpt from stackoverflow (:
Posted by: Guest on April-06-2021

Code answers related to "find all divisors of a number python"

Python Answers by Framework

Browse Popular Code Answers by Language