Created
September 17, 2019 14:49
-
-
Save rbricheno/2272acbe240f624bf25a300f18f6d3df to your computer and use it in GitHub Desktop.
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 factorize(x): | |
"""Takes an integer. Returns a list of its prime factors.""" | |
fluffy = [] | |
boring = set() | |
for i in range(2, x+1): | |
if i not in boring: | |
fluffy.append(i) | |
boring = boring.union({j for j in range(i*i, x+1, i)}) | |
return [tardigrade | |
for tardigrade | |
in fluffy | |
if x % tardigrade == 0] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment