We all know what a square root is. It's the number that for any $x$, you can calculate $n * n = x$.
Is there an equivalent function to determine for any $x$ that you can calculate $n ^ n = x$? How would that work?
We all know what a square root is. It's the number that for any $x$, you can calculate $n * n = x$.
Is there an equivalent function to determine for any $x$ that you can calculate $n ^ n = x$? How would that work?
As said in comments, the solution of equation $n^n=x$ is given in terms of Lambert function $$n=\frac{\log (x)}{W(\log (x))}$$ As said, you must take care that, depending on the value of $x$, two solutions may exist.
From a practical point of view, if you have no access to Lambert function, the solution can easily be found numerically; the most convenient manner of setting the equation is $$f(n)=n\log(n)-\log(x)$$ If you use Newton method, starting from a "reasonable" guess $x_0$, it will be updated according to $$n_{k+1}=n_k-\frac{f(n_k)}{f'(n_k)}$$ which, in your case, will write $$n_{k+1}=\frac{n_k+\log (x)}{\log (n_k)+1}$$ Wikipedia page shows pretty accurate approximations for generating the starting value $n_0$.
For large values of $z$, the first order expansion is $$W(z)\approx L_1-L_2+\frac{L_2}{L_1}$$ where $L_1=\log(z)$ and $L_2=\log(L_1)$.
For illustration purposes, let us consider the case where $x=123456789$ and , being lazy, let us start at $n_0=10$. The successive iterates provided by Newton method will then be $8.66939$, $8.64004$, $8.64003$ which is the solution for six significant figures.
You could notice that, using the approximation formula, we get an extimate equal to $8.39803$ which is very reasonable.
Method such Halley converge faster.