标签:style color io for sp div on c 代码
拥有超过500个因数的第一个三角数(1+2+3+4+......)
def findivisionnum(num):
count = 0
n=1
import math
while count<num:
count = 0
for i in range(1,int(math.sqrt(triangle(n)))+1):
if not triangle(n)%i:
count +=2
if int(math.sqrt(triangle(n)))==math.sqrt(triangle(n)):
count -=1
n += 1
return triangle(n-1)
def triangle(n):
return n*(n+1)/2
print findivisionnum(500)
[Finished in 13.9s]
标签:style color io for sp div on c 代码
原文地址:http://www.cnblogs.com/fei-hsueh/p/3997007.html