Cayley’s formula to compute the smallest value of n [closed]

Using algebra, the problem is not too difficult.

Taking logarithms, you want to find the zero of function $$f(n)=(n-2)\log(n)-k$$ with $k >0$ which implies $n> 2$. Since $f(n) < n \log(n)$ an upper bound of the solution is given by $$ n \log(n)=k \implies n > \frac{k}{W(k)}$$ where $W(k)$ is Lambert function.

Using $n_0=\frac{k}{W(k)}$ and performing one single iteration of Halley method, as an estimate $$n_1=n_0+\frac{2 f(n_0) \,f'(n_0)}{f(n_0)\, f''(n_0)-2 f'(n_0)\,f'(n_0)}$$ with $$f'(n)=1-\frac{2}{n}+\log (n)\qquad \text{and} \qquad f''(n)=\frac{n+2}{n^2}$$

Trying for a few values of $k$

$$\left( \begin{array}{ccc} k & \text{estimate} & \text{solution} \\ 1 & 2.32508 & 2.93018 \\ 2 & 3.36478 & 3.57121 \\ 3 & 4.01581 & 4.11917 \\ 4 & 4.55253 & 4.61541 \\ 5 & 5.03460 & 5.07733 \\ 6 & 5.48307 & 5.51425 \\ 7 & 5.90796 & 5.93184 \\ 8 & 6.31492 & 6.33389 \\ 9 & 6.70758 & 6.72306 \\ 10 & 7.08840 & 7.10131 \\ 11 & 7.45919 & 7.47015 \\ 12 & 7.82130 & 7.83074 \\ 13 & 8.17581 & 8.18404 \\ 14 & 8.52357 & 8.53081 \\ 15 & 8.86526 & 8.87170 \\ 16 & 9.20148 & 9.20724 \\ 17 & 9.53270 & 9.53789 \\ 18 & 9.85934 & 9.86405 \\ 19 & 10.1818 & 10.1861 \\ 20 & 10.5003 & 10.5042 \end{array} \right)$$ and as usual, you will use for the inequality $\lceil n \rceil$.

For $k=\log(10^6)$ as in the question, this would give $n_1=8.45989$ while the solution is $n=8.46730$ that is to say $n=9$. Checking $$8^6=262144 < 10^6 \qquad \text{while} \qquad 9^7=4782969 > 10^6$$