Let p(n) denote the product of the nonzero digits of n. For example, p(5) = 5, p(37) = 21, and p(604) = 24. Without resorting to a computer, evaluate
p(1) + p(2) + p(3) + ... + p(999999).
(In reply to
re: solution  I forgot about something by Charlie)
As described in my previous post, we need to add in the values for all the numbers containing zeros (1 through n1 of them in all the combinations of positions after the first digit). We need the sum of each of these lines:
45
45^2 + 45
45^3 + 2*45^2 + 45
45^4 + 3*45^3 + 3*45^2 + 45
45^5 + 4*45^4 + 6*45^3 + 4*45^2 + 45
45^6 + 5*45^5 + 10*45^4 + 10*45^3 + 5*45^2 + 45
The sum of all these is 9,474,296,895. I did use a computerbased calculator program for this, as I didn't see a shortcut the way I did in the previous "solution" and it's no fun typing these into a calculator rather than pasting.
Added:
I see I could have simplified to
6*45 + 15*45^2 + 20*45^3 + 15*45^4 + 6*45^5 +45^6
which would not have been as horrendous typing into a calculator.
Edited on August 23, 2019, 12:25 pm

Posted by Charlie
on 20190823 12:18:08 