Skip to content

Instantly share code, notes, and snippets.

@igorvanloo
Last active July 22, 2021 15:29
Show Gist options
  • Save igorvanloo/3c12f8e20308a7a639f57c686099b95b to your computer and use it in GitHub Desktop.
Save igorvanloo/3c12f8e20308a7a639f57c686099b95b to your computer and use it in GitHub Desktop.
Divisor Function
def Divisors(x):
divisors = []
for i in range(1, int(math.sqrt(x)) + 1):
if x % i == 0:
divisors.append(i)
divisors.append(int(x/i))
divisors.remove(x) #Remove this line if you want to include x as a divisor of x
return (divisors)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment