题目描述:
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
代码:
import math
def isPrinmer(num):
ret=True
for i in range(2,int(math.sqrt(num)+1)):
if num%i==0:
ret=False
return ret
return ret
sum=0
for i in range(2,2000001):
if isPrinmer(i):
sum+=i
print sum