# How many positive integers $n$ satisfy $n = P(n) + S(n)$

Let $P(n)$ denote the product of digits of $n$ and let $S(n)$ denote the sum of digits of $n$. Then how many positive integers $n$ satisfy

$$n = P(n) + S(n)$$

I think I solved it, but I need your input.

I first assumed that $n$ is a two digit number. Then $n=10a+b$ and according to the requirement

$$10a + b = ab + a + b\\ \Rightarrow 9a = ab \\ \Rightarrow b = 9$$ (Since a is not zero) Now we have { 19,29,39,49,59,69,79,89,99} a set of 9 numbers that satisfy the requirement. However if we assume a three digit number $n=100a+10b+c$ then

$$100a+10b+c = abc+a+b+c\\ \Rightarrow 99a+9b=abc\\ \Rightarrow 9(11a+b) = abc\\$$ Either two of the digits are $1$ and $9$ or $3$ and $3$ and for any such cases the left hand side is much larger than the right side. If there cannot be three digit number, there cannot be higher cases.

Is this good reason?

• "If there cannot be three digit number, there cannot be higher cases." Why? (I'm not saying you're right or you're wrong, but this isn't an argument in itself.) – Billy Jul 15 '13 at 20:08
• because $9(111a+11b+c)=abcd$ has much larger number on the left – Niya Iyer Jul 15 '13 at 20:11
• Your intuitive reasoning is correct, but you might want to make it a bit more rigorous before it is seen as fully correct proof. – Peter Košinár Jul 15 '13 at 20:19
• Possible duplicate. – Kunnysan Jul 15 '13 at 20:21
• I wrote a program to test this up to $10,000,000$ and found only $9$ numbers. – wjm Jul 15 '13 at 20:50

In general, if you have $n-$ digit number $A=\overline{a_1a_2...a_n},$ then $P(A)+S(A)\le 9^n+9n$ whereas $A\ge 10^{n-1}.$ So we must have $10^{n-1}\le 9^n+9n,$ which becomes impossibel fairly quickly due to the growth of the left hand side.
• Ermm... did you mean $A\geq 10^{n-1}$? – Peter Košinár Jul 15 '13 at 20:15
• Specifically, from $n=22$ onwards this is impossible. However that still leaves a lot of numbers to check. – vadim123 Jul 15 '13 at 20:32
• One can reduce the bound all the way down to $n=4$ by considering the first digit of the number separately and thus getting tighter bounds on $A$, $P(A)$ and $S(A)$ (one sufficient condition for impossibility is $10^{n-1}-9^{n-1}-1 > 9(n-1)$; with $n=3$ only narrowly escaping being ruled out too). – Peter Košinár Jul 15 '13 at 20:40
hint : consider the inequality $10^x\leq 9^x+9x$