Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

This question already has an answer here:

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}_{primes}^n=????$$

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.

share|improve this question
    
For your second question: $2+3+5+7+11+13+17+19=77$ and $77$ is not a prime number. –  user93957 Jan 1 at 10:26
    
OK thanks but what about the first question? –  user118545 Jan 1 at 10:28
1  
If you want an exact formula for the sum: No known formula. Asymptotic formulae can be obtained. –  Daniel Fischer Jan 1 at 11:37
    
This question has previously been answered in each of these answers: Question 1, Question 2, Question 3. –  Eric Naslund Jan 1 at 21:17
add comment

marked as duplicate by Eric Naslund, Charles, Thomas Andrews, Old John, ncmathsadist Jan 1 at 23:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4 Answers

In this answer, I use partial summation to show that

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

Where $\text{li}(x)=\int_2^x \frac{1}{\log t}dt$ is the logarithmic integral. Letting $k=1$, we see that $$\sum_{p\leq x } \text{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.

share|improve this answer
add comment

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

share|improve this answer
    
OK thanks but I'm interested in that first question. –  user118545 Jan 1 at 10:27
    
No problem. Me too! –  mathlove Jan 1 at 10:28
add comment

$$ \sum_{p\le x}p\sim \frac{x^2}{2\log x} $$

share|improve this answer
add comment

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([\frac{n-1}{ \sum_{m=2}^{j} \left[\frac{1} { \sum_{k=2}^{m} [1-\frac{m}{k}+[\frac{m}{k}]] } \right]} ]-\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)

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.