I have been writing in python for only few months now, so please don't be too harsh on me. But I've wrote this code and I don't know how I can make it faster.
n = 2
ListOfTriangles = []
ListOfDivisors = []
term = 0
for x in range(1,100001):
x = (n*(n-1))/2
ListOfTriangles.append(int(x))
n += 1
for y in range(1,100001):
Tri = ListOfTriangles[term]
for i in range(1,Tri+1):
if(Tri%i==0):
ListOfDivisors.append(i)
if len(ListOfDivisors) >= 500:
print("---------------------------------------------------")
print(len(ListOfDivisors))
print(ListOfDivisors)
print(ListOfTriangles[term])
print("---------------------------------------------------")
break
print(ListOfTriangles[term]," - ",len(ListOfDivisors)," - ",(term/100000)*(10**2),"%")
ListOfDivisors = []
term += 1
Basically what I have done if you can't tell by this mess, is that i created a list with Triangular Numbers and then put this list through loop that list all factors for each number found in the list and then stop when it finds number that meats the requirement of number having over 500 factors.