def is_deficient_prefect_abundant(a): """Returns: -1 if number is deficient 0 if it's proper 1 if it's abundant""" f = proper_factors(a) d = sum(f) - a if d > 0: return 1 if d < 0: return -1 return d
def fact(n): try: return d[n] except KeyError: d[n] = proper_factors(n) return d[n]