Commit 46e928fd5bc7227a966a30bce3ceaa91d5869bc8
1 parent
6b1db6fa
Removed old_12 (same code)
Showing
1 changed file
with
0 additions
and
31 deletions
old_12.py deleted
1 | -#!/usr/bin/python | ||
2 | - | ||
3 | -import sys; | ||
4 | -import math; | ||
5 | - | ||
6 | -def getNumFactors(num): | ||
7 | - | ||
8 | - count = 0; | ||
9 | - for x in range (1,int(math.ceil(num/2))+1): | ||
10 | - if((num % x) == 0): | ||
11 | - count += 1; | ||
12 | - | ||
13 | - return count+1; | ||
14 | - | ||
15 | -def calculateTriangleNumber(pos): | ||
16 | - | ||
17 | - sum = 0; | ||
18 | - for i in range (1,pos+1): | ||
19 | - sum += i; | ||
20 | - | ||
21 | - return sum; | ||
22 | - | ||
23 | -def getTriangleNumber(numFactors): | ||
24 | - num = 2; | ||
25 | - while(True): | ||
26 | - if(getNumFactors(calculateTriangleNumber(num)) > numFactors): | ||
27 | - return calculateTriangleNumber(num); | ||
28 | - num += 1; | ||
29 | - | ||
30 | -numFactors = int(sys.argv[1]); | ||
31 | -print "Result is: " + str(getTriangleNumber(numFactors)); | ||
32 | \ No newline at end of file | 0 | \ No newline at end of file |