From 99b7386d930b3a229860e88cc392b45b12cc00ae Mon Sep 17 00:00:00 2001 From: MitchellHansen Date: Fri, 5 Feb 2016 22:33:21 -0800 Subject: [PATCH] Doesn't actually work, but done for tonight --- problem_12.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 problem_12.py 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)