内容目录
Largest prime factor
Problem 3
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
Go to the thread for problem 3 in the forum.
import math
n=600851475143
i=2
print math.sqrt(n)
while i< =math.sqrt(n):
if (n%i==0):
while (n%i==0): n=n/i
print i;
i=i+1
print n