Average of primes less than $p(n)$? Am trying to justify what I assume is a consequence of the prime number theorem but not quite getting there. Letting $\pi(n)$ be the number of primes not exceeding $n$ and $p(k)$ the $k$th prime, I think
$$S(n)=\frac 1 n \sum_{k=1}^n p(k) \sim \pi^{-1}(n/2). $$
For example, $S(100000)=622607$ and $2\pi(622607) = 101614.$
So $$\pi(S(n))\sim n/2, $$ 
and to some approximation
$$\frac{S(n)}{\log(S(n))}\sim n/2. $$
and maybe $S(n)\sim \exp\{\frac{2}{n}S(n)\}$ but I don't see how the Taylor series works here. So I think I have goofed somewhere, though numbers seem to bear out the relation. 
Edit: The hint in the comments and Eric Naslund's previous answer to related questions show that $\sum p_k \sim n^2\log n/2.$ Then it is easy to show that 
$$n\cdot S(n)\sim n\pi^{-1}(n/2)\sim n^2\log n/2. $$
 A: $$ \sum_{n=1}^{x}p_{n} \sim Li (x^{2}) $$
A: Since $p_k \approx k(\ln k + \ln \ln k -1)$ and $S(n) = \frac{1}{n} \sum \limits_{k=1}^{n} p_k \approx \frac{1}{n} \int \limits_{2}^{n} k(\ln k+\ln \ln k-1) dk \approx -\frac{\text{li}\left(n^2\right)}{2 n}-\frac{3 n}{4}+\frac{1}{2} n \log
   (n)+\frac{1}{2} n \log (\log (n))$ by simply calculating integrations, and for $\ln \ln k$ use integration by parts.
substituting instead of $li(n^2) \approx \frac{n^2}{2 \ln n}$ we get the final approximation which is $$-\frac{3 n}{4}+\frac{1}{2} n \log (n)+\frac{1}{2} n \log (\log (n))-\frac{n}{4
   \log (n)} $$  
Also $\pi^{-1}(n/2)$ is just $p_{n/2}$ in approximation about $O(\frac{1}{n^{0.4}})$ (and there is better approximations)
But the above approximation suggest that its $p_n$ when dividing $p_n$ over $p_{n/2}$ we get close and approach $2$. so in a sense its true yet there is a better approximation than $p_{n/2}$ or $p_{n/3}$ and so on which is $p_n$ and the above approximation is even better and surly there are much and much better. 
