Largest prime factor
Problem:
What is the largest prime factor of the number 600851475143?
Solution:
1 2 3 4 5 6 7 8 9 10 11 | n = 600851475143 x = 2 while x * x <= n: while n % x == 0: if n == x: break n = n / x x = x + 1 print(n) |
Note: This problem was taken from Project Euler (www.projecteuler.net).
Comments
Post a Comment