I'm working on a root-finding problem and dealing with a function with factorial. $\epsilon$ is a very small machine error, approximately $2 \times 10^{-16}$, which is a tolerance to prevent infinite iterations. And $x$ is a known value, which are $[0.1,1,10,100,1000]$. Therefore, there are five functions I need to find the root of $n$. $$ r = \frac{x^{n+1}}{(n + 1)!} \approx \epsilon $$ My idea is that
\begin{align} r &= \frac{x^{n+1}}{(n+1)!} \\ \log r &= \log \frac{x^{n+1}}{(n+1)!} \\ \log r &= (n+1)\log x - \log (n+1)! \end{align} $\log r$ should be a number around $-16$ and we can find the root. But the problem requires me not to use Stirling's approximation; moreover, I cannot use cumulative sum for $\log$ because $n$ can be a decimal number. Could someone provide some ideas how to continue this problem? Thank you very much. No need to worry about root finding algorithm. I just need to construct a doable function that I can deal with on Python.