Largest prime factor in Python

This is the problem number four in the Project Euler which reads: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? My own solution to resolve this problem is the following: def primeFactors(n): factors=[] d=2 while(d*d<=n): while(n>1): while n%d==0: factors.append(d) n=n/d d+=1 …

Largest prime factor in Python Read More »