## The sum of the primes below $10$ is $2 + 3 + 5 + 7 = 17$.

Find the sum of all the primes below two million.

### Solving the problem directly through computation might take quite a while as there are 148,933 prime numbers below two million. Instead, we can use a simple, yet powerful algorithm called the “Sieve of Eratosthenes” to list out all prime numbers below two million.

Once we have the primes, we just sum them up.

The algorithm works as follow:

1. Create a list of integers from 2 to N (2 million in our case).

2. Start from the first number in the list which is 2, the first prime number.

3. Mark off the multiples of this number up to N.

4. Find the smallest number in the list greater than the number you started with and repeat from step 3.

5. If there are no more numbers to check, all the unmarked numbers in the list are primes.

However, this problem requires quite a good grasp of programming and is not practical to be solved manually. For the sake of the solution, I will provide the Python code to solve it:

“`python

def sum_primes(n):

sum, sieve = 0, [True] * n

for p in range(2, n):

if sieve[p]:

sum += p

for i in range(p*p, n, p):

sieve[i] = False

return sum

print(sum_primes(2000000))

“`

When you run this program, it will output the sum of all prime numbers below two million, which is 142,913,828,922.

##### More Answers:

$10001$st PrimeLargest Product in a Series

Special Pythagorean Triplet