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

I would have thought the sum of the first $n$ primes was asymptotically equivalent to $(n^2 \log n)/2$. (The $n$th prime is near $n \log n$, so the sum of the integers up to the $n$th prime is near $(n \log n)^2/2$, but only a proportion $1/\log n$ of the summands are prime.
–
Michael LugoApr 29 '11 at 14:28

It is not difficult to calculate upper bounds on $s(n)$ from bounds on the prime counting function $\pi(n)$. Just use integration by parts,
$$
s(n) = \int\_0^n x\\,d\pi(x) = n\pi(n) - \int\_0^n\pi(x)\\,dx.
$$
I'm not sure what the currently best known bounds for $\pi(x)$ are but, checking Wikipedia, gives
$$
\frac{x}{\log x}\left(1+\frac{1}{\log x}\right) < \pi(x) < \frac{x}{\log x}\left(1+\frac{1}{\log x}+\frac{2.51}{(\log x)^2}\right)
$$
with the left hand inequality holding for $x\ge599$ and the right hand holding for $x\ge355991$. So,

$$
s(n)\le \frac{n^2}{\log n}\left(1+\frac{1}{\log n}+\frac{2.51}{(\log n)^2}\right)-\int^n\left(1+\frac{1}{\log x}\right)\frac{x\\,dx}{\log x}+c
$$
(where $c$ is a constant which you can compute if you feel so inclined). Applying integration by parts,

You can also take $c=0$ if you only require the bound to hold for $n\ge N$ (some $N$), since the term I neglected in the integral by applying $\log x\le \log n$ grows withuot bound, and will eventually dominate any constant term. Obviously, if you know any better bounds for $\pi(n)$ then you will get improved bounds for $s(n)$. For example, the same Wikipedia article linked to above states that $\left\vert\pi(x)-{\rm Li}(x)\right\vert\le\frac{\sqrt{x}\log x}{8\pi}$ for $x\ge2657$ under the assumption that the Riemann hypothesis holds.

The following paper gives the asymptotic expansion of the sum of the first $n$ prime numbers. Hence for sufficiently large $n$, the first few positive and negative terms of the asymptotic expansion will give best upper and lower bound on the sum of primes.

So Michael Lugo's heuristic actually can be made effective...
–
Marc PalmApr 29 '11 at 15:08

1

Not exactly: there is a difference between the sum of primes less than or equal to $n$, and the sum of the $n$ first primes. I must have missed something: how could $s(n) \sim n^2 \ln(n)/2$ have not be proven before 1996 by Bach and Shallit? I do not see what is wrong with the fact that, since, $p_n \sim n \ln(n)$ (prime number theorem), one has: $\sum_{k=1}^n p_k \sim \sum_{k=1}^n k \ln(k) \sim \int_1^n t\ln(t) \mathrm{d}t \sim n^2\ln(n)/2$
–
BernikovApr 29 '11 at 15:11

Sorry, I have missed that difference. I did not read carefully.
–
Marc PalmApr 29 '11 at 15:18