Created
July 11, 2013 12:57
-
-
Save Ayrx/5975212 to your computer and use it in GitHub Desktop.
Factorization snippet
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 factors(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