Project Euler problem 10 is to find the sum of all primes less than 2 million. I have written a program that does this, and it works, but it takes an excruciatingly long amount of time. What I'm asking is if there is any way I could optimize this to make it run much faster.
I wrote it in an app on my iPad called Pythonista.
def checkPrime(number):
if number == 2:
return True
if number < 2:
return False
if number % 2 == 0:
return False
for i in range(3, (number**1/2)-1, 2):
if number % i == 0:
return False
return True
primes = [i for i in range(10000) if checkPrime(i)]
print sum(primes)