What is the mathematical formula to find the sum of the first 1000 prime numbers? I am trying to improve my coding skills at codeeval (doing practice problems).
One of the programming questions I have to answer is to write code that will sum the first 1000 prime numbers.
What is the mathematical formula to find the sum of the first 1000 prime numbers?

I have an earlier question asking a more general form of this question, where I allow primes to be raised to an arbitrary power ($k=1$ here). This answer gives an efficient algorithm for computing the sum of the primes up to a given bound mod an arbitrary $m$.
The algorithm would not be efficient if you chose $m$ very large, so instead run the algorithm repeatedly with many small coprime values of $m$ and reconstruct the answer with the Chinese Remainder Theorem.
Now you know how to find the sum of the primes up to $N$, so all you need is to find a number $N$ which is at least as large as the 1000-th prime but smaller than the 1001-st prime. You can do that with the Sieve of Eratosthenes, as mentioned in other answers, or with the Deléglise-Dusart-Roblot algorithm used in the earlier steps.
You see? All you need to finish this homework assignment is an understanding of research-level mathematics and an implementation of a complex algorithm which (to my knowledge) has never yet been written.
Of course, you could just find the first 1000 primes and add them. This is asymptotically inefficient but takes about a millisecond at this problem size. You could also look up A007504 in the OEIS where you will find the answer directly.
