TITLE: Sum up numbers from 1 to 100000 after removing zeroes
QUESTION [7 upvotes]: Ok so i have numbers from 1 to 100000.I need to remove the zeroes from all numbers and sum up numbers from 1 to 100000.So if the number is 405 consider it as 45 , if number if 20039 consider it 239.
Is there any mathematical way to solve this, i mean any formula or anything.

REPLY [19 votes]: It's slightly more natural to consider the numbers from $1$ to $99999$, since they form complete sets of numbers with a certain number of digits; we can then add $1$ for $100000$ in the end.
There are $\displaystyle\binom5k$ ways to select $k$ of the $5$ digits to be non-zero, and they all lead to the same numbers when the zeros are removed. Every non-zero digit can take the values $1$ through $9$, whose sum is $9(9+1)/2=45$. The digits can be chosen independently, so the total for $k$ non-zero digits is $45$ for a given digit times $9^{k-1}$ options for the remaining digits times $\underbrace{1\ldots1}_k=(10^k-1)/9$ for the sum of the valencies of the digits, for a grand total of
$$
\begin{align}
\sum_{k=0}^5\binom5k45\cdot9^{k-1}\frac{10^k-1}9
&=
\frac59\left(\sum_{k=0}^5\binom5k90^k-\sum_{k=0}^5\binom5k9^k\right)
\\
&=
\frac59\left(91^5-10^5\right)
\\
&=3466789695\;.
\end{align}
$$
Add the $1$ for $100000$, and the result coincides with Mark's.