# Asymptotic expression for sum of first n prime numbers?

Is one known? If not, what are the best known bounds? Is there reason to think that an asymptotic expression is beyond current methods if none exists?

• Maybe $\int_0^n \frac{t}{\log(t)}dt$? – thedude Mar 11 '16 at 20:20
• $$\sum_{k = 1}^n p_k \sim \frac{n^2}{2}\log n$$ since $p_k \sim k\log k$. You can get more terms in an asymptotic expansion if you take a more precise estimate for $p_k$, look up Dusart's bounds for $p_k$ if you're interested. – Daniel Fischer Mar 11 '16 at 20:21
• Concerning Dusart's bounds suggested by Daniel Fischer see for example <math.stackexchange.com/questions/434229/…> – Raymond Manzoni Mar 11 '16 at 23:33

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).}$$