# An asymptotic connection between nth prime number and prime counting function

I am trying to prove an asymptotic between the nth prime number and the prime-counting function. Numerically it seems right but I don't know if every step is correct. So here we go: We know that $$\pi(n)\sim\frac{n}{\log n} \quad \mathrm{and} \quad p_n \sim n\log n \qquad (n\rightarrow\infty).$$ The first statement can be rewritten as $$\pi(n) \sim \frac{n\log n}{\log^2 n} \qquad (n\rightarrow\infty).$$ Now, is the next step valid? $$\pi(n)\log^2 n\sim n\log n \qquad (n\rightarrow\infty).$$ If this step is valid we can continue and say that $$\pi(n)\log^2 n\sim p_n \qquad (n\rightarrow\infty),$$ which is my desired outcome.

Yes, all the steps are justified. In general, $$f(n) \sim g(n) \implies h(n) \cdot f(n) \sim h(n) \cdot g(n),$$ and in your case, you can just multiply the prime number theorem by $$\log^2 n$$ and substitute $$p_n$$ for $$n\log n$$ (since $$\sim$$ is also transitive).
Just remember the definition of $$f\sim g$$, i.e., that $$\lim\frac fg = 1$$.