Find $x$ in the equation $x^x = n$ for a given $n$

107 Views Asked by At

Simply: How do I solve this equation for a given $n \in \mathbb Z$?

$x^x = n$

I mean, of course $2^2=4$ and $3^3=27$ and so on. But I don't understand how to calculate the reverse of this, to get from a given $n$ to $x$.

2

There are 2 best solutions below

3
On BEST ANSWER

Simpler:

If $x^x = n$, then $x\ln(x) = \ln(n) =y$.

Let $f(x) = x\ln(x)-y $. $f'(x) =\ln(x)+1 $.

Applying Newton's iteration, starting with $x = \frac{y}{\ln y}$, $x_{new} =x-\frac{f(x)}{f'(x)} =x-\frac{x\ln(x)-y}{\ln(x)+1} =\frac{x\ln(x)+x-x\ln(x)+y}{\ln(x)+1} =\frac{x+y}{\ln(x)+1} $.

Iterate until cooked.

5
On

See this wikipedia article: Lambert W function

If $x^x=n,$ then $$x=\dfrac{\ln n}{W(\ln n)},$$ Where $W$ is the Lambert W function.