def divisors(n): fact = []; for i in range(1, int(n**0.5) + 1): if not(n % i): fact.append(i) if n / i != i: fact.append(n / i) fact.sort() return fact
from math import sqrt, floor- def divisors(n):
- fact = [];
for i in range(1, int(floor(sqrt(n))) + 1):- for i in range(1, int(n**0.5) + 1):
- if not(n % i):
- fact.append(i)
- if n / i != i:
- fact.append(n / i)
- fact.sort()
- return fact