Skip to content

Instantly share code, notes, and snippets.

@hatashiro
Created April 19, 2012 07:46
Show Gist options
  • Save hatashiro/2419466 to your computer and use it in GitHub Desktop.
Save hatashiro/2419466 to your computer and use it in GitHub Desktop.
Projecteuler #12
import math
def numDivisor(integer):
i = 1
num = 0
limit = int(math.sqrt(integer))
while True:
if not integer%i:
num = num + 1
i = i + 1
if i > limit:
break
num = num * 2
if limit == math.sqrt(integer):
num = num - 1
return num
num = 0
i = 0
while True:
i = i + 1
num = num + i
if numDivisor(num) > 500:
print num
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment