Skip to content

Instantly share code, notes, and snippets.

@hatashiro
Created April 18, 2012 07:52
Show Gist options
  • Save hatashiro/2411842 to your computer and use it in GitHub Desktop.
Save hatashiro/2411842 to your computer and use it in GitHub Desktop.
Projecteuler #10
import math
def isPrime(num):
if num == 1:
return False
div = 2
obj = num
sqrt = int(math.sqrt(num))
while True:
if div > sqrt:
return True
if obj%div:
div = div + 1
else:
return False
i = 1
sum = 0
while i <= 2000000:
if isPrime(i):
sum = sum + i
i = i + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment