Return to Snippet

Revision: 27076
at May 21, 2010 10:41 by chroto


Initial Code
#!/usr/bin/python

# Project Euler - Problem 12

# Find the first triangle number to have over 500 divisors
import math

i = 1
tri = 0
cnt = 2
last = 0
while True:
    
    tri += i
    i += 1
    cnt = 0
    for z in range(1,int(math.sqrt(tri))):
        if tri % z == 0:
            cnt += 2
    if cnt > 499:
        break

print tri

Initial URL


Initial Description


Initial Title
Project Euler - Problem 12

Initial Tags


Initial Language
Python