# What is the value of the first triangle number to have over five hundred divisors?
# The sequence of triangle numbers is generated by adding the natural numbers
value=1
count=1
factors=0
while factors<500:
   factors=0
   for i in range(1,int(value**0.5)+1):
      if value%i==0:
         factors+=2
   if value%value**0.5==0:
      factors-=1
   count+=1
   value+=count
print(value-count)
# 2783915461-1
