Let $s(n)$ denote the sum of primes less than or equal to n. Clearly, $s(n)$ is bounded from above by the sum of the first $n/2$ odd integers $+1$. $s(n)$ is also bounded by the sum of the first $n$ primes, which is asymptotically equivalent to $\frac{n^2}{2\log{n}}$. It should thus be possible to find estimates for $s(n)$ using the fact that for an $\epsilon > 0$ and $n$ large enough $s(n) < (1+\epsilon)\frac{n^2}{\log{n}}.$


I would like to know if there are any known sharp upper bounds for $s(n)$. That is, I am looking for a function $f(n)$ such that for every $n > N\_0$ $$ s(n) \leq f(n)$$


As a way of relaxing the question, $s(n)$ could be regarded as the sum of the primes in the interval $[c,n]$ given a constant $c$.



Upper bounds for the sum of primes up to $n$
By partial summation
$$ s(n) = n\pi(n)-\sum\_{m=2}^{n-1}\pi(m) $$
so by the Prime Number Theorem
$$ s(n) = \frac{n^2}{\log n}-\sum\_{m=2}^{n-1}\frac{m}{\log m}+O\left(\frac{n^2}{\log^2 n}\right). $$
The sum on the right is
$$ \sum\_{m=2}^{n-1}\frac{m}{\log m} = \int\_2^n \frac{x}{\log x}dx + O\left(\frac{n}{\log n}\right) $$
using the monotonicity properties of the integrand. Now the integral equals, by partial integration,
$$ \int\_2^n \frac{x}{\log x}dx = \left[\frac{x^2}{2\log x}\right]\_2^n + \int\_2^n \frac{x}{2\log^2 x}dx = \frac{n^2}{2\log n} + O\left(\frac{n^2}{\log^2 n}\right).$$
Altogether we have
$$ s(n) = \frac{n^2}{2\log n} + O\left(\frac{n^2}{\log^2 n}\right).$$
This can be made more precise both numerically and theoretically.


