You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
457 B
24 lines
457 B
import math
|
|
#find the first triangle number with over five hundred divisors
|
|
|
|
|
|
def countDivisors(number):
|
|
count = 0
|
|
for i in range (1, int(math.sqrt(number))):
|
|
if number % i == 0:
|
|
count += 1
|
|
return count
|
|
|
|
running = True
|
|
counter = 1
|
|
while(running):
|
|
sum = 0
|
|
for i in range(0, counter + 1):
|
|
sum += i
|
|
if countDivisors(sum) > 400:
|
|
print(counter)
|
|
running = False
|
|
counter += 1
|
|
|
|
print(counter)
|