 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Summing the product of digits (Posted on 2019-08-23) 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).

 No Solution Yet Submitted by Danish Ahmed Khan No Rating Comments: ( Back to comment list | You must be logged in to post comments.) revised solution | Comment 3 of 4 | (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 n-1 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 computer-based 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.

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 2019-08-23 12:18:08 Please log in:

 Search: Search body:
Forums (0)