Problem:
Given a positive integer n, let p(n) be the product of the non-zero digits of n. (If n has only one digit, then p(n) is equal to that digit.) Let
S=p(1)+p(2)+p(3)+⋯+p(999)
What is the largest prime factor of S?
Solution:
Consider each positive integer less than 1000 to be a three-digit number by prefixing 0's to numbers with fewer than three digits. The sum of the products of the digits of all such positive numbers is
(0⋅0⋅0+​0⋅0⋅1+0⋅0⋅2+⋯+9⋅9⋅8+9⋅9⋅9)−0⋅0⋅0=(0+1+2+⋯+9)3−0​(*)
However, p(n) is the product of the non-zero digits of n. The sum of these products can be found by replacing 0 by 1 in the above expression, since ignoring 0's is equivalent to thinking of them as 1's in the products. (Note that the final 0 in (∗) becomes a 1 and compensates for the contribution of 000 after it is changed to 111.) Hence
n=1∑999​p(n)=(1+1+2+⋯+9)3−1=463−1=(46−1)(462+46+1)=33⋅5⋅7⋅103
and the largest prime factor is 103​.
The problems on this page are the property of the MAA's American Mathematics Competitions