diff options
author | mjf <mjf@localhost.localdomain> | 2020-02-04 12:11:30 -0500 |
---|---|---|
committer | mjf <mjf@localhost.localdomain> | 2020-02-04 12:11:30 -0500 |
commit | 6aa02212cd6dfbb492fa1f70b60a4fe3d48892e5 (patch) | |
tree | 1b655714c9709ee8fce333fcb6a6be3f5533b2d3 /bigfactors2.py.orig | |
parent | 8e431d287c0e89041506da4c4da57e3e3d657d72 (diff) | |
download | Project_Euler_Solutions-6aa02212cd6dfbb492fa1f70b60a4fe3d48892e5.tar.gz |
cleanup and added more c examples:
Diffstat (limited to 'bigfactors2.py.orig')
-rw-r--r-- | bigfactors2.py.orig | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/bigfactors2.py.orig b/bigfactors2.py.orig deleted file mode 100644 index 41bc13d..0000000 --- a/bigfactors2.py.orig +++ /dev/null @@ -1,32 +0,0 @@ -import PIL, math - -#Problem 12 Highly divisible triangular number -#finds the first number with over 500 factors - -def countfactors(num): - factors = 0 - ### we only need to know about the FIRST HALF of factors, - ##one factor implies a second - root = int(math.ceil(math.sqrt(num))) - divs = range(1, root) - for d in divs: - if(num%d == 0): - factors += 2 - - #Correction if the number is a perfect square - if (root * root == num): - factors-=1 - return factors - - -#### MAIN ##### -i=1 -k=1 -j = 0 -while(k < 500): - j += i - k=countfactors(j) - print(str(j) + " has " + str(k) + " factors") - i += 1 - -print("Ding! Ding! {} has over 500 factors, wow!".format(j)) |