(f)
return True
Test whether f is the factorization of a practical number.
Test whether f is the factorization of a practical number.
Test whether f is the factorization of a practical number .
def isPracticalFactorization(f):
    """Test whether f is the factorization of a practical number."""
    f = list(f.items())    
    # f.sort()
    sigma = 1
    for p,x in f:
        if sigma < p - 1:
            return False
        sigma *= (p**(x+1)-1)//(p-1)
    return True
def isPracticalFactorization ( f ) : f = list ( f . items ( ) ) # f.sort() sigma = 1 for p , x in f : if sigma < p - 1 : return False sigma *= ( p ** ( x + 1 ) - 1 ) // ( p - 1 ) return True