1 | initial version |
My best shot so far is iterating over the divisors of the radical of $n$ and saturating prime powers in them:
def unitary_divisors4(n):
fn = factor(n)
D = {p:(k-1) for p,k in fn if k>1}
return sorted( prod(p^k for p,k in D.items() if d%p==0)*d for d in divisors(prod(p for p,_ in fn)) )
2 | No.2 Revision |
My best shot so far is iterating over the divisors of the radical of $n$ and saturating prime powers in them:
def unitary_divisors4(n):
fn = factor(n)
D = {p:(k-1) [(p,k-1) for p,k in fn if k>1}
k>1]
return sorted( prod(p^k for p,k in D.items() D if d%p==0)*d for d in divisors(prod(p for p,_ in fn)) )