#20: Factorial digit sum | Ben Cunningham

#20: Factorial digit sum

Problem by Project Euler · on June 21, 2002

means

For example, , and the sum of the digits in the number is .

Find the sum of the digits in the number

Python

import functools
import operator
import math

def v_sum(x):
    if len(x) < 1:
        return 0
    return functools.reduce(operator.add, x)
    
def l_digits(x):
    return [int(y) for y in list(str(x))]
    
ans = v_sum(l_digits(math.factorial(100)))

print(ans)
## 648