fork download
  1. from math import sqrt
  2.  
  3. def suma_dzielnikow_2(n):
  4. suma = 1 + n
  5. for j in range(2, int(sqrt(n)) + 1):
  6. if n % j == 0:
  7. suma += j
  8. if j != n // j:
  9. suma += n // j
  10.  
  11. return suma
  12. print(suma_dzielnikow_2(10))
Success #stdin #stdout 0.1s 14180KB
stdin
Standard input is empty
stdout
18