projecteuler---->problem=3----Largest prime factor

题目:

The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?

翻译:

13195的质因数有5丶7丶13丶29。

问:600851475143的最大质因数是……?

解答:

import math
a=600851475143
# b=math.sqrt(a)
b=775146
m=0
for i in range(2, b):
	if a%i == 0:
		if i > m:
			m = i
		a /= i
	else:
		continue
i=2
print m


你可能感兴趣的:(python)