Find a number such that $S(n)+P(n)=n$

78 Views Asked by At

Find a number $n\in \mathbb N$ such that $S(n)+P(n)=n$. Where $S(n)$ is sum of digits, and $P(n)$ is product of digits

I know that $9|n-S(n)$ ,since $n-S(n)=P(n)$ then $9|P(n)$ so at least one number must be nine or two digits $\ldots33 \ldots$ then I go with number $19,29,39,49,59,69,79,89,99$ for all this number $P(n)+S(n)=n$ but for number like 199 or 999 I just can not reach that number using formula, but I do not know how to prove it is not enough just to say that. And I do not know is there some other number can you help me?

3

There are 3 best solutions below

0
On BEST ANSWER

A couple of examples should suffice to show that we cannot have $n=S(n)+P(n)$ if $n$ has more than two digits:

$$100a+10b+c=a+b+c+abc\implies c=9\left({11\over b}+{1\over a} \right)\ge9\cdot{11\over10}\gt9$$

and

$$1000a+100b+10c+d=a+b+c+d+abcd\implies d=9\left({111\over bc}+{11\over ca}+{1\over ab}\right)\ge9\cdot{111\over10\cdot10}\gt9$$

In general, if $n=a_k10^k+\cdots+a_0$ with $k\gt1$, then $n=S(n)+P(n)$ implies the contradiction

$$a_0\ge9\left((10^k-1)/9\over a_{k-1}\cdots a_1\right)\ge9\left(1+10+\cdots+10^{k-1}\over10^{k-1} \right)\gt9$$

(Note, for $k=1$, we just get $a_0\ge9$, which is not a contradiction.)

0
On

Hint: If a number $n$ is $k$ digits long and begins with the digit $d$, then

$$S(n)\leq 10(k-1)+d$$

and

$$P(n)\leq d9^{k-1},$$

so

$$d10^{k-1}\leq n=S(n)+P(n)\leq d\left(9^{k-1}+1\right)+10(k-1).$$

$$d\left(10^{k-1}-9^{k-1}-1\right)\leq 10(k-1).$$

$$10^{k-1}-9^{k-1}-1\leq 10(k-1).$$

Can you show that this has no solutions for $k\geq 4$, thus reducing it to the $k=3,d=1$ case? And then can you solve it from there using the same techniques you used in the body of your question?

0
On

Hint:

Write $$n= a_0+10a_1+10^2a_2+...+10^ka_k$$ where $a_k\ne 0$. Then $n\geq 10^k$, but $P(n)=a_0a_1...a_k\leq 9^{k+1}$ and $S(n)\leq 9(k+1)$. So we have $$10^k\leq 9^{k+1}+9(k+1)$$

Clearly $k$ can not be big in fact only several $k$ works here (with calculator I find $k\leq 20$)...