def primeslist(max): ''' 求max值以内的质数序列 ''' a = [True]*(max+1) a[0],a[1]=False,False for index in range(2, len(a)): if a[index]==True: for i in range(index+index,len(a),index): a[i]=False return [i for i, j in enumerate(a) if j==True] temp = primeslist(2000000) print(sum(temp))