mirror of
https://github.com/correl/euler.git
synced 2024-11-27 11:09:54 +00:00
Problem 034
git-svn-id: file:///srv/svn/euler@61 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
This commit is contained in:
parent
8bc3076a0d
commit
9b40c70b2c
1 changed files with 20 additions and 0 deletions
20
e034.py
Normal file
20
e034.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
import math
|
||||
|
||||
def sum_factorial(n):
|
||||
s = str(n)
|
||||
total = 0
|
||||
for c in s:
|
||||
total = total + math.factorial(int(c))
|
||||
return total
|
||||
|
||||
MAX = 100000
|
||||
|
||||
if __name__ == '__main__':
|
||||
total = 0
|
||||
i = 2
|
||||
while i <= MAX:
|
||||
i = i + 1
|
||||
if i == sum_factorial(i):
|
||||
print i
|
||||
total = total + i
|
||||
print 'Total:', total
|
Loading…
Reference in a new issue