fork(1) download
  1. import math
  2.  
  3. def perfeito(n_min, n_max):
  4. lista = []
  5. for n in range(n_min, n_max + 1):
  6. soma = 1
  7. for div in range(2, math.ceil(math.sqrt(n))):
  8. if n % div == 0:
  9. soma += div
  10. div2 = int(n / div)
  11. if (div != div2):
  12. soma += div2
  13. if soma > n:
  14. break
  15. if n == soma:
  16. lista.append(n)
  17. return lista
  18.  
  19. print(perfeito(33550335, 33550337))
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
[33550336]