Created
April 19, 2012 07:46
-
-
Save hatashiro/2419466 to your computer and use it in GitHub Desktop.
Projecteuler #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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