2

The sum of primes < n has been answered (though not asked, some book/paper references of this would be nice too) by @Eric Naslund here: What is the sum of the prime numbers up to a prime number $n$?

as

$$\sum_{p\leq x } \text{li}\left(x^{2}\right)+O\left(x^{2}e^{-c\sqrt{\log x}}\right),$$

I can see that $$\text{li}\left(x^{2}\right)$$ can be approximated using $$\operatorname{li}(x)\sim\frac{x}{\log(x)-1}$$ in which case as $$\ log(x^{2})=2log(x) $$

$$\operatorname{li}(x^{2})\sim\frac{x^{2}}{2log(x)}$$

so I can at least calculate numerically the first part correctly, but I am having difficulty with the big O part.

1) I want to calculate the big O numerically but,

2) I don't know what the c is or what to numerically put there.

3) Is the big O the maximum error (absolute) as the sum goes to infinity? or the growth rate of the error?

4) How would it calculate for me the error at say n=1000?

onepound
  • 1,365

2 Answers2

2

By $O(f(x))$ we mean a function which, when divided by $f(x)$, gives a function with some non-zero finite limit as $x\to\infty$. (There are also problems where the intended meaning is as $x\to\infty$, e.g. $\ln (1+x)=O(x)$.) Technically $O(f(x))$ is defined as the set of such functions, so that $g=O(f)$ is an abuse of notation meaning $g\in O(f)$; you can interpret $g=h+O(f)$ similarly.

For numerical estimates you may be out of luck, because the term will approximate $Ax^2e^{-c\sqrt{\log x}}$ for some nonzero $A,\,c$. You might be able to prove some bounds on this from the logic in this answer. However, for an order-of-magnitude estimate it's usually safe to assume $A\approx 1$.

J.G.
  • 115,835
1

The prime number theorem $$\pi(x) = \sum_{2 \le n \le x} \left(\frac{1}{\log n}+\mathcal{O}( e^{-c\sqrt{\log n}})\right)$$ implies by partial summation

$$\sum_{p \le x} p =\sum_{2 \le n \le x} n \left(\frac{1}{\log n}+\mathcal{O}( e^{-c\sqrt{\log n}})\right)= \int_2^x \frac{t}{\log t}dt+\mathcal{O}(x^2 e^{-c\sqrt{\log x}})\\=\int_4^{x^2} \frac{\sqrt{u}}{\log \sqrt{u}}\frac{du}{2 \sqrt{u}}+\mathcal{O}(x^2 e^{-c\sqrt{\log x}})=\text{Li}(x^2)+\mathcal{O}(x^2 e^{-c\sqrt{\log x}})$$

And $\text{Li}(x)=\int_2^x \frac{dt}{\log t} \sim \frac{x}{\log x}$ follows from $\frac{x}{\log x} = \frac{2}{\log 2}+\int_2^x\left( \frac{1}{\log t}-\frac{1}{\log^2 t}\right)dt$

reuns
  • 77,999
  • what c is chosen for the big O? is there any book reference with $\sum_{p \le x} p =\text{Li}(x^2)+\mathcal{O}(x^2 e^{-c\sqrt{\log x}})$ ? All the ones I've looked at are little o which is not good. – onepound Oct 16 '17 at 21:52
  • https://en.wikipedia.org/wiki/Prime_number_theorem https://en.wikipedia.org/wiki/Summation_by_parts – reuns Oct 16 '17 at 22:33