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?

$\endgroup$
  • $\begingroup$ try something like solve(n^n = 2^1000,n) instead of what you did. $\endgroup$ – Myself Mar 17 '11 at 13:13
  • $\begingroup$ Out of curiosity. Where does this equation come up? Or is it just an exercise? $\endgroup$ – user2468 Mar 17 '11 at 16:57
3
$\begingroup$

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.

$\endgroup$
5
$\begingroup$

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$.

$\endgroup$
  • $\begingroup$ The wolframalpha link in the question actually has the $n = \exp(W(c\log 2))$ solution. :) $\endgroup$ – leif Mar 17 '11 at 15:08
  • $\begingroup$ @leif: I noticed that after I posted the answer. $\endgroup$ – Shai Covo Mar 17 '11 at 15:23
3
$\begingroup$

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}$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.