# how to get value of n if the value of n * log n is given? [duplicate]

Possible Duplicate:
How can I solve for $n$ in the equation $n \log n = C$?

how to get value of n if the value of n * log n is given ? I am stuck with this:

n log n = 6 * 10^6


how to tackle such equations ?

-

## marked as duplicate by MJD, Jason DeVito, Ross Millikan, Rudy the Reindeer, tomaszOct 13 '12 at 9:28

$\log$ is to the base 10? This specific problem can be done by inspection.... –  Hurkyl Oct 13 '12 at 0:47
@Hurkyl yes. 10 can be used as the base. Mainly i am looking for approach to solve this so things can be assumed. –  Tejas Patil Oct 13 '12 at 1:11
Does $n$ have to be integers? –  Patrick Li Oct 13 '12 at 1:22

In general, the equation $x \log(x) = a$ cannot be solved for $x$ in closed form in terms of elementary functions. "Elementary functions" refers to the functions formed via the composition of the basic arithmetic operations +, -, *, /, the exponential and logarithm functions, and the trigonometric functions (though the inclusion of these last functions is redundant if one uses complex numbers, due to Euler's formula.), with the composition being finite.

Usually, elementary solutions are considered the best, though, as this shows, they are in many cases not possible. (There are analogies of this in other areas of mathematics -- e.g. in Euclidean geometry, constructions relying only on compass and straightedge are considered the best. Again, there are many cases in which such construction is not possible.) This is because elementary functions are simple and have numerous useful properties.

That being said, if one is willing to venture outside the realm of elementary functions, one can solve this equation. One commonly used non-elementary, but still simple to describe, function is the Lambert W function, defined as the inverse of $f(x) = xe^x$. Note this is similar to a logarithm function, but not quite the same. Such an inverse is not a proper function, since $f(x) = xe^x$ is not injective, however, we usually define a "principal branch" similar to, say, square root, by inverting on the interval $[-1, \infty)$. The Lambert W-function is denoted $W(x)$. To use it to solve your equation, make the substitution $x = e^u$.

However, if your $\log$ is base-10, then there is an elementary solution, namely $n = 10^6$! The form of the right-hand side makes me wonder whether a base-10 log was meant.

-
Do you mean $n = 10^6$ in the second to last line? –  Michael Zhao Oct 13 '12 at 2:32
Fixed that. For some reason, I was thinking $n 10^n$ :) –  mike4ty4 Oct 13 '12 at 3:06

If you can't solve it by inspection, it is unlikely there is a "nice" solution. In that case you can use the fact that $\log n \ll n$ and varies slowly. So in this problem, you can write it as $n=\frac {6 \cdot 10^6}{\log n}$ Then for a first guess use $n=6 \cdot 10^6$, take the log to get $6.778$, plug that in and evaluate $n$, iterating until it converges.

-

For this kind of problem, with a specific number given, an iteration formula is best. What matters most is that n appear once in a direct way (the factor n) and once in a slowly-varying way (the logarithm).

(I'll take the log to be natural base.)

Since log(n) varies slowly, and is "small" relative to n, we'll take it to be "constant" and set it to 1 just for a moment. Then n = the given number, 6E6. Obviously wrong; log(6E6) (using base e) is about 15. Okay, take n to be 6E6/15.607 and plug that into the logarithm to get a "better" number than 15.607. Repeat...

n = 6E6
n ← (6.0E6)/log(n)   (repeat)


This converges quickly to n=460147.3...

If you need some sort of analytic formula, exp() both sides and maybe the Lambert W function or something similar will be helpful. There won't be any solution in terms of common everyday arithmetic and familiar functions.

-
I think the log is base 10. –  Ross Millikan Oct 13 '12 at 2:59