3
$\begingroup$

How to solve $n$ for $n^n = 2^c$?

What's the numerical method?

I don't get this.

For $c=1000$, $n$ should be approximately $140$, right?

  • 0
    Out of curiosity. Where does this equation come up? Or is it just an exercise?2011-03-17

3 Answers 3

3

Yes, take the $log_2$ of both sides gives you:

$n log_2(n) = c$

You can use Newton's method to solve this:

$x_0 = c$ $x_{k+1} = x_k - (x_k log(x_k) - c log(2))/(1 + log(x_k))$

where now "log" is the natural logarithm.

This gives the solution $n \sim x_4 = 140.221667$.

Starting with a better $x_0$, like $x_0=c / log(c)$ gives you even faster convergence. With c=1000 or c=1000000, the value $x_3$ is correct with an error of $10^{-8}$.

5

Hint: Consider this.

Hint 2: First take $\log$ on both sides.

And explicitly: The solution to your question is given by $ n = e^{W(c\log 2)} = \frac{{c\log 2}}{{W(c\log 2)}}. $ For $c=1000$, this gives $n \approx 140.2217$. The function $W$ is standard (ProductLog in Wolfram Mathematica).

EDIT: For large $c$, a rough but very simple approximation to the solution $n$ of $n^n = 2^c$ can be obtained as follows (cf. this, also for improvement of the approximation): $ n \approx (c\log 2)[\log (c\log 2)]^{1/\log (c\log 2) - 1} . $ For example, for $c=1000$ this gives $n \approx 141.2083$, not far from the exact value of about $140.2217$.

  • 0
    @leif: I noticed that after I posted the answer.2011-03-17
3

Alpha sometimes goes off into the complex plane when what you want is only the reals. I agree with you and get about 140.222. If you ask to solve n(ln(n))=1000 ln(2) you get what you want.