(n)
Helper function for divisors which generates the divisors.
Helper function for divisors which generates the divisors.
Helper function for divisors which generates the divisors .
def _divisors(n):
    """Helper function for divisors which generates the divisors."""

    factordict = factorint(n)
    ps = sorted(factordict.keys())

    def rec_gen(n=0):
        if n == len(ps):
            yield 1
        else:
            pows = [1]
            for j in xrange(factordict[ps[n]]):
                pows.append(pows[-1] * ps[n])
            for q in rec_gen(n + 1):
                for p in pows:
                    yield p * q

    for p in rec_gen():
        yield p
def _divisors ( n ) : factordict = factorint ( n ) ps = sorted ( factordict . keys ( ) ) def rec_gen ( n = 0 ) : if n == len ( ps ) : yield 1 else : pows = [ 1 ] for j in xrange ( factordict [ ps [ n ] ] ) : pows . append ( pows [ - 1 ] * ps [ n ] ) for q in rec_gen ( n + 1 ) : for p in pows : yield p * q for p in rec_gen ( ) : yield p