Skip to content

Instantly share code, notes, and snippets.

@develalfy
Created October 8, 2014 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save develalfy/bf91ede05210df2280e7 to your computer and use it in GitHub Desktop.
Save develalfy/bf91ede05210df2280e7 to your computer and use it in GitHub Desktop.
Euler
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