10. Given a positive integer $n$, let $p(n)$ be the product of the non-zero digits of $n$. For example, $p(7)=7, p(204)=2 \times 4=8$, etc. Let $S=p(1)+p(2)+\cdots+p(999)$. What is the largest prime factor of $S$ ?
(1 mark)
對於正整數 $n$, 設 $p(n)$ 為 $n$ 的所有非零數字之積。
例如: $p(7)=7$ 、 $p(204)=2 \times 4=8$ 等。
設 $S=p(1)+p(2)+\cdots+p(999)$ 。那麼， $S$ 最大的質因數是甚麼？
10. 103
10. By setting $p(0)=1$, we may write $S=p(000)+p(001)+p(002)+\cdots+p(999)-p(000)$. Since we are now computing the product of non-zero digits only, we may change all the 0 's to 1 's, i.e. $S=p(111)+p(111)+p(112)+\cdots+p(999)-p(111)$. Each term is the product of three numbers, and each multiplicand runs through $1,1,2,3,4,5,6,7,8,9$ (note that 1 occurs twice as all 0 's have been changed to 1 's). Hence we see that
$$
\begin{aligned}
S & =(1+1+2+3+\cdots+9) \times(1+1+2+3+\cdots+9) \times(1+1+2+3+\cdots+9)-1 \\
& =46^{3}-1 \\
& =(46-1) \times\left(46^{2}+46+1\right) \\
& =3^{2} \times 5 \times 2163 \\
& =3^{2} \times 5 \times 3 \times 7 \times 103
\end{aligned}
$$

It follows that the answer is 103 .