feat(solution): problem #34

main
steven 2023-08-02 12:33:45 -04:00
parent 6af7cea6a0
commit f4e606a6d7
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
factorials = list(range(10))
factorials[0] = 1
for i in range(1, 10):
factorials[i] = factorials[i - 1] * i
def sum_factorials(n):
sum = 0
for i in list(str(n)):
sum += factorials[int(i)]
return sum
sum_all_factorials = 0
for i in range(10,10000000):
if i == sum_factorials(i):
sum_all_factorials += i
print(sum_all_factorials)