003:

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

What is the largest prime factor of the number 600851475143 ?


Answer:
6857

 

 


  1. roots = [] 
  2. product = 1 
  3. x = 2 
  4. number = input("number?: "
  5. y = number 
  6. while product != number: 
  7.     while (y % x == 0): 
  8.         roots.append(x) 
  9.         y /= x 
  10.         product *= roots[-1
  11.     x += 1 
  12. print roots