Project Euler 3 Largest prime factor
Largest prime factorThe prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
python:
n = 600851475143
i = 2
l = []
while i<=n:
if n%i==0:
while n%i==0:
n=n//i
l.append(i)
i+=1
print(l)
print(l[-1])
6857
页:
[1]