Problem 3:
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
import math pSieve = [] max = math.floor(math.sqrt( 600851475143 )) l = 0 i=2; while i<max: ii = math.floor(math.sqrt( i )) found = False j=0 while j<len(pSieve): if ( pSieve[j] > ii ): break; if (i % pSieve[j] == 0): found = True break; j+=1 if found == False: pSieve.append(i) if (600851475143 % i == 0): l=i i+=1 print l |