Created
February 10, 2012 21:36
-
-
Save anonymous/1793117 to your computer and use it in GitHub Desktop.
Embedly problem 1 in python
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 math | |
def sumAFactorial(number): | |
strn = str(number) | |
length = len(strn) | |
numsum = 0 | |
for digit in range(0,length): | |
numsum += int(strn[digit]) | |
return numsum | |
for n in range(1, 1001): | |
numsum = sumAFactorial(math.factorial(n)) | |
if numsum == 8001: | |
print n | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment