/ Published in: Python

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/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
Comments
