Created
October 8, 2014 12:07
-
-
Save develalfy/bf91ede05210df2280e7 to your computer and use it in GitHub Desktop.
Euler
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
def get_max_primary_factor(n): | |
data = [] | |
for i in range(100000, 1, -1): | |
if n % i == 0: | |
data.append(i) | |
for x in range(2, i + 1): | |
if i % x == 0 and i != x: | |
if i in data: | |
data.remove(i) | |
return max(data) | |
import time | |
start = time.time() | |
print(get_max_primary_factor(600851475143)) | |
elapsed = (time.time() - start) | |
print(elapsed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment