Created
April 17, 2020 20:40
-
-
Save wiccy46/61e1f5087581bc9bb8c001435b1a687c to your computer and use it in GitHub Desktop.
[divisors] Find all divisors of a number, inkl 1 and self. #python #math
This file contains 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 get_divisors(n): | |
return set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment