$\pi(x)$ is defined as number of primes less than or equal to x. Gauss showed that $\pi(x) \approx \frac{x}{log(x)}$. I want to calculate the inverse of that approximation because I want to estimate how far should I sieve in order to get the number of primes that I want. Here are the steps that I took.
$$\begin{align}y &= \frac{x}{\log(x)}\\ x &= y \log(x) \\ e^x&=e^{y\log(x)} \\ e^x &= (e^{\log(x)})^y \\ e^x &= x^y\end{align}$$
I am stuck at this point. How can I calculate $y$ in terms of $x$?
Resorting to Lambert's $W$ is a little overkill.
With $$x=y\ln y,$$ we have
$$\frac x{\log x}=\frac{y\ln y}{\ln(y\ln y)}=\frac{y\ln y}{\ln y+\ln\ln y}\approx y.$$
Given that the distribution is anyway approximate, this can be a sufficient approximation of the inverse. Or you can use it as a starting value for Newton's iterations (use few of them anyway).