I'm trying to get the sum of all the prime numbers below 2,000,000 in Python, using a lambda function. (I've bruteforced it, but that takes much too long, and I want a better solution.) Here is what I have so far:
def isPrime(n):
for x in range(2, int(n**0.5)+1):
if n%x==0: return False
return True
print reduce(lambda x: isPrime(x), [range(200)])
Now, this just prints numbers incrementing from 1 to 200, so I don't think reduce is working =\
Anyone have any tips?