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

What is the largest prime factor of the number 600851475143 ?

Simply factorize the target number and select the maximum value from the factors. Should be pretty simple. It should be noted, however, that simply iterating through every number is not going to suffice, because a number can have two of the same factors.

For example, the number 28 has a prime factorization of 2, 2, and 7. The fact that there are two 2’s in the factorization should be taken into account when writing your solution.

Python Implementation