Problem
This problem comes from Project Euler 20
Problem
means .
For example, , and the sum of the digits in the number is .
Find the sum of the digits in the number
Solution
Another simple problem.
- Calculate
- Convert the number into a string
- Iterate over the string and convert into a number array
- Sum the array
Code
# Project Euler: Problem 20
# Factorial digit sum
from math import factorial as f
number = f(100)
number_list = [int(i) for i in str(number)]
print(sum(number_list))