Problem Description
n! means n × (n − 1) × … × 3 × 2 × 1
Find the sum of the digits in the number 100!
Analysis
Same solution as problem 16.
Solution
Runs < 1 second in Python.
def fact(n): return reduce(lambda x,y:x*y,range(1,n+1),1) print "Answer to PE20 = ", sum(int(i) for i in str(fact(100)))





Discussion
No comments for “Project Euler Problem 20 Solution”