My brain is kinda fried, so I'm having trouble finding the pattern that I should use to represent this question generally.
If p(n) represents the product of all digits in the decimal representation of a number n (i.e. p(246) = 246 = 48), how do I find $\sum_{n=10}^{99} p(n)$? Obviously I don't want to calculate it out, so I'm assuming there is some kind of shortcut.
How can I generalize it to find $\sum_{n=10^k}^{10^{k+1}-1} p(n)$ for any k >= 0?
Complete answer (using distributivity of course).
Suppose $k \ge 1$. It is easy to that $p(10^pa+b) = p(a)p(b)$ if $b < 10^p$. (This means that if you have a number $n$, such that $a$ is the first digit of $n$, and $b$ is the number formed if you delete (not subtract, but erase it altogether) $a$ from $n$. For example, if $n = 256$, $a = 2$ and $b = 56$.)
Also $$\sum_{n=10^k}^{10^{k+1}-1} p(n) = \sum_{n=10^k+1}^{10^{k+1}} p(n)$$for $k \ge 1$ since $10^k$ and $10^{k+1}$ end with a zero.
Now, define $$s_k = \sum_{n=10^k+1}^{10^{k+1}} p(n)$$for $k\ge 1$. $s_0 = 45$(that is, the sum of numbers from $1$ to $9$.)
Then $$s_k = \sum_{n=10^k+1}^{10^{k+1}} p(n) = 1s_{k-1}+2s_{k-1}+3s_{k-1} ... 9s_{k-1}$$Thus, $$s_k = s_{k-1}\sum_{i=1}^9i = 45s_{k-1}$$
We have $s_0 = 45$. Thus, $s_k = 45^{k+1}$.