diff --git a/problem_12.py b/problem_12.py new file mode 100644 index 0000000..ad51aeb --- /dev/null +++ b/problem_12.py @@ -0,0 +1,23 @@ +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)