I have written the following to code to find largest prime factor of the number 600851475143 but the computation time is too large. Is there anything I can do to reduce the computation time. Thanks!
def factor(n):
answer = []
for i in range(1,(n//2) + 1):
if n%i == 0:
print(i)
answer.append(i)
return answer
def prime_factor(n):
l = n[:]
for i in n:
for j in range(2,i):
if i%j == 0:
l.remove(i)
break
return l
print(prime_factor(factor(600851475143)))