## $145$ is a curious number, as $1! + 4! + 5! = 1 + 24 + 120 = 145$.

Find the sum of all numbers which are equal to the sum of the factorial of their digits.

Note: As $1! = 1$ and $2! = 2$ are not sums they are not included.

### This problem requires a little bit of programming skills or at least an understanding of the methodology on how to tackle it. According to the problem, we are asked to find numbers that are equal to the sum of the factorials of their digits.

First, let’s make some observations before finding such numbers:

1. The upper limit of such a number is 2540160, which is the result of 9!*7. This is because the factorial function increases rapidly, and after 2540160, no seven-digit number can be written as the sum of the factorials of its digits.

2. We already know from the problem statement that 145 is one such number.

3. If the number has one digit, we should exclude it as the problem states the sum attained cannot be the same number, ruling out the case where the number is a single digit.

Now we only have to loop from 10 to 2540160. For each number encountered, we do the following algorithm:

– Convert the number into individual digits.

– Find the factorial of each digit and find their sum.

– If the sum equals the original number, we should add it to our answer.

After you perform this procedure, you will find only two such numbers, namely 145 and 40585.

Thus, the sum of all numbers which are equal to the sum of the factorial of their digits is 145 + 40585 = 40730.

##### More Answers:

Coin SumsPandigital Products

Digit Cancelling Fractions