The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
求600851475143的最大素数因子。
Python
1 factors = [] 2 maximum = 600851475143 3 def getFactor(x): 4 y = x / 2 5 i = 2 6 while True: 7 if i > y: 8 break 9 if x % i == 0 :10 factors.append(i)11 return getFactor(x / i)12 break13 i += 114 return x15 16 factors.append(getFactor(maximum))17 18 print factors[-1]