Created
July 29, 2018 17:38
-
-
Save gavincangan/6f9024fbe6fa5fa26258f5336ff4595e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import math | |
def find_fact(num, cur_quot=[]): | |
ix = 3 | |
if(num < 2): | |
return cur_quot | |
while(ix < math.sqrt(num)): | |
if(num % ix == 0): | |
cur_quot.append(ix) | |
# print(ix) | |
return find_fact(num/ix, cur_quot) | |
ix += 2 | |
cur_quot.append(num) | |
num = 317584931803333 | |
s = time.time() | |
cur_quot = [] | |
while(num % 2 == 0): | |
cur_quot.append(2) | |
num /= 2 | |
find_fact(num, cur_quot) | |
e = time.time() | |
print(cur_quot) | |
print(e-s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment