10
$\begingroup$

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.

$\endgroup$
5
  • 1
    $\begingroup$ For your second question: $2+3+5+7+11+13+17+19=77$ and $77$ is not a prime number. $\endgroup$
    – user93957
    Commented Jan 1, 2014 at 10:26
  • $\begingroup$ OK thanks but what about the first question? $\endgroup$
    – user118545
    Commented Jan 1, 2014 at 10:28
  • 1
    $\begingroup$ If you want an exact formula for the sum: No known formula. Asymptotic formulae can be obtained. $\endgroup$ Commented Jan 1, 2014 at 11:37
  • $\begingroup$ This question has previously been answered in each of these answers: Question 1, Question 2, Question 3. $\endgroup$ Commented Jan 1, 2014 at 21:17
  • $\begingroup$ Do you mean from $k=1$? Isn't $p_0=1$? $\endgroup$
    – Collag3n
    Commented Mar 30, 2019 at 19:34

4 Answers 4

13
$\begingroup$

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.

$\endgroup$
1
  • 1
    $\begingroup$ Upto what limit can I use this to a good level of approximation? $\endgroup$
    – Soham
    Commented Dec 7, 2017 at 4:52
9
$\begingroup$

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

$\endgroup$
4
$\begingroup$

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

$\endgroup$
3
  • $\begingroup$ OK thanks but I'm interested in that first question. $\endgroup$
    – user118545
    Commented Jan 1, 2014 at 10:27
  • $\begingroup$ No problem. Me too! $\endgroup$
    – mathlove
    Commented Jan 1, 2014 at 10:28
  • $\begingroup$ See also oeis.org/A013917 $\endgroup$
    – Charles
    Commented Oct 19, 2021 at 15:19
3
$\begingroup$

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)

$\endgroup$

Not the answer you're looking for? Browse other questions tagged .