Project Euler - 34 / Find a mathematical approach for upper bound 
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.

So I tried a random enough large upper bound (100000) in my program and it worked.
I deleted this part to not spoil the answer
My question is : How to find the closest upper bound using a mathematical approach ?
 A: Let $P(n)$ be the sum of the factorials of the digits of $n$. I apologize that this answer is not mathematically rigorous; the purpose is more to give my ideas rather than to prove.
Since $9!=362880$ is six digits, we can expect a seven digit number to have $P(n)$ at most seven digits (Note: $P(9999999) = 2540160$ is seven digits).
Similarly, An eight digit number will yield at most a seven digit $P(n)$. So once we reach eight digits, it is no longer possible. More precisely, anything above $2540160$ is impossible, since this is the highest $P(n)$ we can get with seven digits.
The highest $P(n)$ we can get with $n < 2540160$ is $2177281$ with $n = 1999999$. So we can use $2177281$ as our best bound. We can use this strategy again by checking the second highest $P(n)$ with $n$ under the bound, and so on. But the presented bound, $2177281$, is not out of the realm of computation by any means.
Perhaps more clever arguments yield better bounds. My method turns into raw computation fairly quickly. On the other hand, some of the numbers just under two million seem fairly valid guesses. This leads me to believe there is not an obvious way to reduce my bound below two million.
edit:
I am looking at it further, and it seems like an argument could reasonably reduce my bound under a million. It seems that in order to get $P(n)$ close to two million while using numbers just under two million, we need a lot of $9$s as digits. So it seems that there are very few candidates, few enough to reasonably check by hand, just under two million.
A: The wikipedia article explains how to get some trivial bounds.
The most trivial one is to note that if the number $n$ has $d$ digits, we have
$$10^{d-1}<n<9!d$$ which yields that $d\leq7$ and thus gives an upper bound of $10^7=10000000$.
