Problem 10
# Problem_10.py """ 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 primes = [] for i in range(2, 2000001): flag = True for x in range(2, int(math.sqrt(i))+1): if i % x == 0: flag = False if flag: print(i) primes.append(i) print(primes) print(sum(primes))