import math
def perfeito(n_min, n_max):
lista = []
for n in range(n_min, n_max + 1):
soma = 1
for div in range(2, math.ceil(math.sqrt(n))):
if n % div == 0:
soma += div
div2 = int(n / div)
if (div != div2):
soma += div2
if soma > n:
break
if n == soma:
lista.append(n)
return lista
print(perfeito(33550335, 33550337))
aW1wb3J0IG1hdGgKCmRlZiBwZXJmZWl0byhuX21pbiwgbl9tYXgpOgogICAgbGlzdGEgPSBbXQogICAgZm9yIG4gaW4gcmFuZ2Uobl9taW4sIG5fbWF4ICsgMSk6CiAgICAgICAgc29tYSA9IDEKICAgICAgICBmb3IgZGl2IGluIHJhbmdlKDIsIG1hdGguY2VpbChtYXRoLnNxcnQobikpKToKICAgICAgICAgICAgaWYgbiAlIGRpdiA9PSAwOgogICAgICAgICAgICAgICAgc29tYSArPSBkaXYKICAgICAgICAgICAgICAgIGRpdjIgPSBpbnQobiAvIGRpdikKICAgICAgICAgICAgICAgIGlmIChkaXYgIT0gZGl2Mik6CiAgICAgICAgICAgICAgICAgICAgc29tYSArPSBkaXYyCiAgICAgICAgICAgICAgICBpZiBzb21hID4gbjoKICAgICAgICAgICAgICAgICAgICBicmVhawogICAgICAgIGlmIG4gPT0gc29tYToKICAgICAgICAgICAgbGlzdGEuYXBwZW5kKG4pCiAgICByZXR1cm4gbGlzdGEKCnByaW50KHBlcmZlaXRvKDMzNTUwMzM1LCAzMzU1MDMzNykp