10

How to find the sum of prime numbers up to a prime number $n$, that is for example: the sum of prime numbers up to 7 is: 2+3+5+7=17.

So what is the formula for finding: $$\sum_{k=0}^n p_k=????,$$ with $p_k$ being the $k$th prime.

Also if we have the sum of an even number of primes then would it be a new prime? Example: 2+3+5+7=17 and 17 is a prime. 2+3+5+7+11+13=41 and 41 is prime.

Thank you.

draks ...
  • 18,449

4 Answers4

13

In this answer, I use partial summation to show that

Asymptotic: For $k>-1$ we have $$\sum_{p\leq x}p^{k}=\operatorname{li}\left(x^{k+1}\right)+O\!\left(x^{k+1}e^{-c\sqrt{\log x}}\right).$$

Where $\operatorname{li}(x)=\int_2^x \frac{1}{\log t}dt$ is the logarithmic integral. Letting $k=1$, we see that $$\sum_{p\leq x } p =\operatorname{li}\left(x^{2}\right)+O\!\left(x^{2}e^{-c\sqrt{\log x}}\right),$$ which implies that $$\sum_{p\leq x} p \sim \frac{x^2}{2\log x}.$$ The sum of the first $n$ primes is not as natural to work with. By using the fact that $p_n\sim n\log n$, along with the above asymptotic, it follows that $$\sum_{k=1}^n p_k \sim \frac{1}{2}n^2 \log n.$$ However the next few terms in the asymptotic expansion are not particularly pretty.

Gary
  • 31,845
Eric Naslund
  • 72,099
9

$$ \sum_{p\le x}p = \frac{x^2}{2\log x} + \frac{x^2}{2\log^2x} + \frac{x^2}{4\log^3x} + \frac{3x^2}{8\log^4x} + O\left(\frac{x}{\log^5x}\right). $$

Charles
  • 32,122
4

I don't know such formula, but I can say your conjecture is not true. $$2+3+5+7+11+13+17+19=77=7\times 11.$$

mathlove
  • 139,939
3

There are formulas for computing prime numbers, the problem lies in the costs and time needed for that and there is often (or we don't know) no closed formula for that, like these ones:

1. $$p_n= 2+ \sum_{j=2}^{2^n} \left(\Bigg[\frac{n-1}{ \sum_{m=2}^{j} \left[\frac{1} { \sum_{k=2}^{m} [1-\frac{m}{k}+[\frac{m}{k}]] } \right]}\Bigg]-\left| \frac{n-1}{ \sum_{m=2}^{j} [\frac{1} { \sum_{k=2}^{m} [1-\frac{m}{k}+[\frac{m}{k}]] } ]}-1\right|\,\right)$$

2.

$$p_n=\left[ 1- \frac{1}{\log(2)} \log\left(-\frac{1}{2} + \sum_{d | P_{n-1}} \frac{\mu(d)}{2^d -1}\right)\right]$$ Where $[x ] = floor(x)$ is the largest integer not greater than x and \begin{cases} \mu(1)=1 ,& \\ \mu(n)=(-1)^r, & \text{if $n$ is product of $r$ distinct prime numbers} \\ \mu(n)=0, & \text{if $n$ has one or more repeated prime factors} \\ \end{cases}

The second one is from "My Numbers, My Friends - Popular Lectures on Number Theory - Paulo Ribenboim", don't know from where is the first one.

I am sure there are more of formulas like that, even for exact n-th prime number, but why we don't use them?

Because we don't know any "effective" ones. Even if we compute some prime numbers with that, it would just take too long to find the big ones. So we use special algorithms for finding prime numbers, which are much faster, for example Sieve of Eratosthenes, and still seek for better and better ones :)

You can also find something here:

http://mathworld.wolfram.com/PrimeFormulas.html

https://oeis.org/A000040(look at formulas at the bottom of page)

Mr Pie
  • 9,459
Kusavil
  • 566