# Find a positive integer $n$ such that its digits product is $n^2 -13n-25$

Find a positive integer $n$ such that its digits product is $n^2 -13n-25$

My attempt

If we assume that $n$ is a two digit integer then let $n=10k+r$ where $1 \leq k \leq 9$ and $0 \leq r \leq 9$ . Plugging $n=10k+r$ in $n^2 -13n-25$ we get $kr=(10k+r)^2 -13(10k+r)-25$. Manipulating this expression as a quadratic for $r$ we conclude that $n=15$ is a solution.

My question
I can't generalize it for any $n$ greater than two digit. Can anyone help? Thanks in advance.

• What about $n=15$? ;-) – Peter Košinár Aug 5 '16 at 11:08
• @PeterKošinár Thanks. My mistake. $n=15$ is indeed a solution. But main question remains. How to generalize for more than two digit? – rugi Aug 5 '16 at 11:11
• Brute-forcing in Haskell, filter (\n->(product $map digitToInt$ show n)==(n^2-13*n-25)) [1..100000] returns [15]. – Rodrigo de Azevedo Aug 5 '16 at 12:31

Notice that the digital product of $n$ is at most $9^m$, where $m$ is the number of digits of $n$. Then, for all values of $n$ with three digits or more, $$9^m \le 9^{\log_{10}(n)+1} < 10^{\log_{10}(n)+1} = 10n < n^2 - 13n - 25.$$ Hence any suitable value of $n$ must have two digits or fewer.

• Thanks for pointing out my mistake. – S.C.B. Aug 5 '16 at 11:30

assume that n is $\ m \$ digit integer $n=\sum_{i=0}^{m-1}a_{i}10^i \\ \prod_{i=0}^{m-1}a_{i}=n^2-13n-25 \geqslant 0 \Rightarrow \boxed{15\leqslant n} \\ \prod_{i=0}^{m-1}a_{i}=a_{0}\times a_{1}\times a_{2}\times ....\times a_{m-2}\times a_{m-1}\leqslant 9^{m-1}\times a_{m-1}< 10^{m-1}\times a_{m-1}\leqslant n \\ n^2-13n-25\leqslant n \\ n^2-14n-25\leqslant 0 \Rightarrow \boxed{n< 16} \\$

Hence $\boxed{n=15}$

Let us assume that $n>10^{20}$. Realize that no digit of $n$ can be $0$. Also, realize that $n^2-13n-25>n$.

Then realize that $n^2-3n-25>n>9^{\text{number of digits of n}} \ge \text{digit product of } n$

So we conclude that no such $n$ can be more than $21$ digits.

EDIT

A far tighter bound can be achieved, as pointed out by @JoshuaCiappara.

If $n$ is $3$ digits, $$n^2-13n-25 \ge 100^2-13 \times 100 -25 >729 \ge \text{digit product of } n$$

The same is true when $n$ is $4$ digits or higher.

So $n$ can be at most $2$ digits. Thus the answer is $15$.

• Even say $n$ has three digits. Then the maximum value of its digit product is $9^3$, which is far less than the minimum value of the quadratic $f(n) = n^2 - 13n - 25$ on three-digit numbers, namely $f(100)$. – Mr. Chip Aug 5 '16 at 11:17
• @JoshuaCiappara Thanks, mind if I use your solution? – S.C.B. Aug 5 '16 at 11:21
• Also all digits but one should be equal $1$ since product cannot be factorized (in integers). – z100 Aug 5 '16 at 11:26