Asymptotic expression for sum of first n prime numbers?

Sinha's paper On the asymptotic expansion of the sum of the first n primes gives quite a bit of info including a few bounds and various asymptotic results (including some from Dusart).

The simple one, as Daniel Fischer pointed out, is

$$\sum_{k=1}^n p_k \approx \frac{n^2}{2}\ln n$$

Dusart (1998) showed

$$\sum_{k=1}^n p_k = \frac{n^2}{2}(\ln n + \ln\ln n - 3/2 + o(1))$$

Sinha (2011) showed

$$\sum_{k=1}^n p_k = \frac{n^2}{2}\left[\ln n + \ln\ln n - \frac{3}{2} + \frac{\ln\ln n}{\ln n} - \frac{5}{2\ln n} - \frac{\ln^2\ln n}{2\ln^2 n} + \frac{7\ln\ln n}{2\ln^2 n} - \frac{29}{4\ln^2 n} + o\left(\frac{1}{\ln^2 n}\right)\right]$$

Axler works through a lot of the math behind these in a June 2016 arXiv paper.

I'd also like to note that it is possible to write a prime sum function similar to fast prime count functions. This gives exact results quite a bit faster than standard sieve+sum code.

For those with a more practical bent, I highly recommend Kim Walisch's Primesum program and documentation. It implements the summation using fast combinatorial methods combined with excellent optimization and parallelization. It has been used to compute exact answers for primes below $10^{24}$ for instance.


Maybe it is interesting to see a easy proof of the simplest approximation. From the PNT and the Abel's summation we have $$\sum_{k=1}^{n}p_{k}\sim\sum_{k=1}^{n}k\log\left(k\right)$$ $$\sum_{k=1}^{n}k\cdot\log\left(k\right) =\frac{n\left(n+1\right)}{2}\log\left(n\right)-\frac{1}{2}\int_{1}^{n}\frac{\left\lfloor t\right\rfloor \left(\left\lfloor t\right\rfloor +1\right)}{t}dt $$ $$=\frac{n^{2}}{2}\log\left(n\right)+O(n^{2}) $$ where $\left\lfloor t\right\rfloor$ is the floor function, hence

$$\color{red}{\sum_{k=1}^{n}p_{k}\sim\frac{n^{2}}{2}\log\left(n\right).}$$