Skip to main content

Euler 0020

The Problem:

What is the sum of the digits of 100! where n! means 1x2x3x4x...xn?

Considerations and Approach:

For Python this is trivial to produce 100! and then take the sum of the digits by converting to a string and back.

The Code:

import math

factorial = 100

number = sum([int(x) for x in str(math.factorial(factorial))])

print(number)