project Euler第三题
题目: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-8a = 600851475143b = 0Li = 3Lwhil
·
题目:
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
更多推荐



所有评论(0)