Solving $s \le n\log n$ for smallest $n$

242 Views Asked by At

I am given an arbitrary positive integer $s$. I want to find the smallest integer $n$ such that

$$s \leq n \log_2 n$$

where $\log_2$ is log base $2$.

Is there an efficient way to compute $n$?

1

There are 1 best solutions below

0
On BEST ANSWER

$$s \leq n\log_2(n)$$ $$s \leq \frac{n\log n}{\log 2}$$ $$s\log 2 \leq n\log n$$ $$s\log 2 \leq e^{\log n}\log n$$ Using the Lambert W function and the fact that you want the smallest $n$, we have $$\log n = W\left(s\log 2\right)$$ $$n =e^{W\left(s\log 2\right)}=\frac{s\log 2}{W\left(s\log 2\right)}$$ As others have stated, you'll need a computer to evaluate this.