Summation of Primes using Python (Project Euler Problem 10 Solution)
Posted by Samath
Last Updated: January 11, 2017

This is a python program that find the sum of all the primes below two million. This program solve Project Euler Problem #10.

import math

def primecheck(num):
  divisor = 3
  sqrt_divided = int(math.sqrt(num))
  while divisor <= sqrt_divided:
    if num % divisor == 0:
      return False
    divisor += 2
  return True
primesum= sum([2] + [x for x in xrange(3,2000001,2) if primecheck(x)])
print"Result: "
print primesum