Created
May 30, 2017 05:49
-
-
Save shekkbuilder/398454acbfaa886ddcd855d5d5b6e758 to your computer and use it in GitHub Desktop.
Print prime factors of number.
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
import sys | |
def factors(n): return ([x]+factors(n/x) for x in xrange(2,n+1) if n%x==0).next() if n>1 else [] | |
num=int(sys.argv[1]) | |
print factors(num) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment