Project Euler 10 Summation of primes
Project Euler 10 Summation of primes
#!/usr/bin/env python
#-*- coding: utf-8 -*-
'''
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
'''
from math import *
def isPrime(num):
if num < 2:
return False
if num == 2:
return True
if num%2 == 0:
return False
i = 3
while( i*i <= num):
if num%i == 0:
return False
i += 2
return True
i=2
s=0
while i<=2000000:
if isPrime(i)==True:
s+=i
print i,s
i+=1