Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
try something like solve(n^n = 2^1000,n) instead of what you did. – Myself Mar 17 '11 at 13:13
Out of curiosity. Where does this equation come up? Or is it just an exercise? – user2468 Mar 17 '11 at 16:57
up vote 3 down vote accepted

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.

share|cite|improve this answer

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

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

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

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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