Product Digit Not Zero

Define p ( n ) p(n) to be the product of all (decimal) digits of the number n n .

What is the value of

p ( 1 ) + p ( 2 ) + p ( 3 ) + p ( 4 ) + + p ( 999 ) ? p(1) + p(2) + p(3) + p(4) + \ldots + p(999)?

Do not include leading zeros in the product.


The answer is 93195.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Mostafa Hubble
Sep 14, 2014

let A=(0+1+2+3+...+9)

B=(0+1+2+3+...+9)(0+1+2+3+...+9)

C=(0+1+2+3+...+9)(0+1+2+3+...+9)(0+1+2+3+...+9)

if you see deeply you find there are all possible product of 1-digit numbers in A..

2-digit numbers in B

3-digit numbers in C

so the answer is: A+B+C=45+45^2+45^3=93195

@Calvin Lin Sir the answer given is incorrect.It must be 97335. The problem maker himself has included leading zeroes in the products and has asked us not to do so. Please change the answer. @mostafa hubble @Sreejato Bhattacharya @Sharky Kesa

Ash Dab - 6 years, 8 months ago

Log in to reply

Yes, it is! I have posted this problem before, just slightly different. The answer is 93195! @Calvin Lin .

Sharky Kesa - 6 years, 8 months ago

Thanks. I have updated the answer to 97335.

Calvin Lin Staff - 6 years, 8 months ago

Log in to reply

I disagree. The original answer treated 1, 2, 3 digit numbers separately and thus dealt with this problem. 97335 comes when we ignore all zeros, not just leading ones. As just a brute force check, see these two cases:

97335 comes on ignoring all (not just leading) zeroes: http://ideone.com/wbqAIf

93195 comes when we only ignore leading zeroes: http://ideone.com/IxMcoa

I am assuming p(909) should be 0, not 81, for example. So 93195 is the correct answer.

ww margera - 6 years, 8 months ago

Log in to reply

@Ww Margera Yes, 93195 is completely correct. I don't understand why it was marked wrong.

Patrick Corn - 6 years, 8 months ago

Log in to reply

@Patrick Corn @ww margera @Patrick Corn , My apologies. I have corrected the answer back to 93195. I did not check the arithmetic that was presented.

Calvin Lin Staff - 6 years, 7 months ago

thank you for updating the answer to 97335

Hemanth Koundinya - 6 years, 7 months ago
Ar Agarwal
Oct 28, 2014

Here's a simple python script to find the same:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
sum=0
for n in range(1,1000):
    product = 1
    i=n
    while(i>0):
        if i%10==0:
            product = 0;
            break;
        product = product*(i%10)
        i=i//10
    sum = sum + product

print(sum)

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...