Product of the digits of an integer $n$ 
Let $g:N\to N$ with $g(n)$ being the product of the digits of $n$.
(a) Prove that $g(n)\le n$ for all $n\in\Bbb{N}$
(b) Find all $n\in\Bbb{N}$, for which $n^2-12n+36=g(n)$
Source ISI UGB 2017


My Attempt:-
Let $n$ be a $m$ digit natural number, then $m=\lfloor\log_{10}{n}\rfloor+1$.
Then, we have the inequality
$$\lfloor\log_{10}{n}\rfloor+1\le\log_{10}{n}+1\\
\implies 9^m=9^{\lfloor\log_{10}{n}\rfloor+1}\le9^{\log_{10}{n}+1}\lt10^{\log_{10}{n}+1}=10n$$
So, we get
$$0\le g(n)\le9^m\\
\implies 0\le g(n)\lt10n\implies -9n\le n-g(n)\le n$$

It seems to me that the bounds are tight enough(not the best but still) so what implications do I need to proceed further. Just give a hint and not spoon feed the whole solution

As for the second part of the question, my attempt was as follows, please comment if its correct:-
Since, $$0\le g(n)\lt10n\implies 0\le (n-6)^2\lt10n\implies n\in(2,20)$$.
Now, since $g(n)$ is a perfect square so if the number is of two digits then it must belong to $\{11,14,19\}$, since none of these numbers satisfy the realtion mentioned in the question so we move onto single digit numbers which will belong to the set $\{1,4,9\}$ which gives us the answer as $\boxed{4}$ and $\boxed{ 9}$
While writing the answer I came up with another way for the final steps for the second part.
For the two digit numbers when $10\lt n\lt20$ we have the solution set represented as $(n-6)^2=n-10,\;\;n\in\Bbb{N}$ which doesn't have any solution. While for the single digit numbers the solution set is $(n-6)^2=n,\;n\in\Bbb{N}$ and the answer turns out to be 4 and 9.

Some intuitive approaches as well as non-intuitive (which I would leave up to you to decide whether it is non-intuitive or not) approaches will be pure bliss.


Edit 1:-
Just for fun I had attempted the first part of the question in the following way too but it doesn't seem to be resulting in anything much. If anyone can some shed some light on this one too.
Let the digits of the number $n$ be represented as
$$n=\sum_{i=1}^{m}{10^{m-i}(10-x_i)}\\
g(n)=\prod_{i=1}^{m}{(10-x_i)}, \;\;\;0\lt x_i\lt9,\;x_i\in \Bbb{N}$$
I was hoping to do some polynomial(I think it is not the correct term for it as I was just analyzing it in general) analysis of $n-g(n)$ but I did not arrive at something interesting so, if possible please shed some light on this one too.
 A: If $n$ is an $m$ digit number, then $10^{m-1}\le n<10^m$ and $0\le g(n)\le 9^m$. Unfortunately, this won't suffice: $9^1>10^0$, $9^2>10^1$, $9^3>10^2$, and so on for quite a while.
We need stricter bounds.
Let $n$ be an $m$ digit number with leading digit $d\in\{1,\ldots,9\}$. Then  the claims follows immediately:
$$g(n) \le d\cdot 9^{m-1}\le d\cdot 10^{m-1}\le n.$$

Your second part is fine. Maybe starting with $g(n)\le n$ instead of $g(n)<10n$, you can shorten it a bit.
A: For your first part, you can argue very simply as follows-
Let $A_1A_2A_3.......A_{n+1}$ be a number with $(n+1)$ digits with $A_i$ being the $i^{th}$ digit. Now consider the example, $n=123$
It can be written as $n=100+20+3$. Following the same manner we may write generally as -
$n=A_1.(10.10.10.......... n$ times $)+k$, where $k$ is some non-negative integer.
Or, $n=A_1.(10^n)+k$
But when we compute $g(n)$, we multiply $A_1$ with $n$ digits each of which is less than $10$ (and greater than or equal to $0$ ofcourse). Therefore this clearly proves that $g(n)$ must be less than $n$ except for single digit numbers where there is nothing to multiply with $A_1$.
Hence $g(n)\le n$ for all $n\in\Bbb{N}$ 

While your second part is absolutely fine, why did you put $10n$ suddenly in the inequality. You just proved that $g(n)≤n$.. 
You could have just continued with that, then you would have got $n≤9$.. simple calculations after that.. 
Hope this helps :)
