# How can I solve for $n$ in the equation $n \log n = C$?

Believe it or not, this isn't homework. It's been many years since grade school, and I'm trying to brush up on these things. But my intuition isn't helping me here.

-
$n\log n = C$ is equivalent to $n^n = e^C$ which has no closed form solution for $n$. There is a solution for $n$ in terms for Lambert W function. – user2468 Aug 30 '12 at 2:26

If what you want is to solve for $n$, there is no simple way. The solution has $n=e^{W(C)} = \frac C{W(C)}$ where $W()$ is the Lambert W function.

-

I will take the base of the logarithm to be $e$. (If you are in a different base; just replace the $e$.)

$$n\log n = C$$

$$\log n = \frac{C}{n}$$

$$e^{\frac{C}{n}} = n$$

$$(e^C)^{\frac{1}{n}} = n$$

$$e^C = n^n$$

-
If you want to do that, would it not be simpler to just raise $e$ to both side of the original equation, obtaining $e^{n\log n} = e^C$, then $\big(e^{\log n}\big)^n = e^C$, then $n^n = e^C$? – MJD Aug 30 '12 at 2:22
@MJD Easier is subjective! – Pedro Tamaroff Aug 30 '12 at 2:24
@MJD I see. You use $e^{\log n} = n$, and I used $\log x = y$ means $e^y = x$. – William Aug 30 '12 at 2:25
I would have characterized the difference this way: You divided through by $n$ at the beginning, and then multiplied by $n$ again in the last step. I was puzzled that you included these two steps, which cancel out and seemingly accomplish nothing. – MJD Aug 30 '12 at 13:42

Since $n \ln n = \ln n^n$, just raise $e$ to each side and you get $n^n = e^C$.

If you want to solve for $n$, I don't know of any method that will work (usually in Computer Science we use approximations or we solve it numerically).

-

You can show that the function $g(x)=x\ln x$ is negative for $0<x<1$ (with a local minimum of $-\frac{1}{e}$ at $\frac{1}{e}$).

It is equal to zero for $x=1$ and is greater than zero for $x>1$.

Therefore we have to make some initial assumptions on $C$. We either have $C\in[-\frac{1}{e},0)$, $C=0$ or $C>0$.

Note that for $C=0$ we have $n=1$ is the solution.

Because $g(x)$ is not one-to-one on $(0,1)$ and has a local minimum we have two solutions for $C\in[-1/e,0)$ so we will disregard this.

There are various ways of solving the equation numerically and here I will just show another idea.

Consider the function $$f_C(x)=\frac{C}{\ln x}.$$ The fixed point of $f_C(x)$, $x_f$ is the $n$ that solves your equation.

If the fixed point is attracting you have a way of approximating it. To be attracting we need $|f_C'(x_f)|<1$. This is equivalent to

$$C<x_f(\ln x_f)^2,$$

but $C=x_f\ln x_f$ and so if $x_f>e$ we have

$$C=x_f\ln x_f<x_f(\ln x_f)^2.$$

So if the solution to the equation is greater than $e$ the fixed point is attracting. Therefore if we can choose an $x_0$ close enough to $x_f$ then the iterations of $x_0$ under $f_C$ will converge to $x_f$.

For example, suppose I am looking at $$400=n\ln n$$ and I start with $x_0=3$. I find after eight iterations that I have correct to four significant figures $n=89.09$.

-