题目:
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
算法:
#!/usr/bin/env python
#coding=utf-8
a = 600851475143
b = 0L
i = 3L
while i < a:
i += 2
if a%i == 0:
a = a/i
b = b if b>i else i
i -= 2
print b
结果:
6857