Here is my code:
triangle_numbers = []
number = 0
for i in range(0, 10000):
number = number+i
triangle_numbers.append(number)
for number in triangle_numbers:
number_of_divisors = 1
for i in range(1, int(number/2)+1):
if number % i == 0:
number_of_divisors = number_of_divisors + 1
if number_of_divisors > 500:
print("FOUND AT ", number)
It takes forever to return the answer. How do I make it faster? I'm a beginner, so if you could walk me through your answer that would be great!
The challenge that I am doing is Highly divisible triangular number - Problem 12Highly divisible triangular number - Problem 12.