# Project Euler

## Factorial digit sum

### Problem 20

*n*! means *n* × (*n* − 1) × … × 3 × 2 × 1

For example, 10! = 10 × 9 × … × 3 × 2 × 1 = 3628800,

and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.

Find the sum of the digits in the number 100!

This problem is similar to problem 16 where the interim result may has many digits so each multiplication must be done carefully using array of integer (or char) to avoid overflow. The idea is essentially the same with any big number problem, use carry and multiply (or add) each digit in sequence for each calculation. Problem 13, 16 and 20, seems to be the solutions for building a big integer library.

Advertisements