Last active
July 22, 2021 15:29
-
-
Save igorvanloo/3c12f8e20308a7a639f57c686099b95b to your computer and use it in GitHub Desktop.
Divisor Function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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