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

What is the largest prime factor of the number 600851475143 ?

http://projecteuler.net/problem=3

highlight below for my solution:

#using a prime number set datastructure - https://gist.github.com/aausch/6709819
p_set = PrimeSet()
n = 600851475143
sqrt = int(n ** 0.5)
p_set[sqrt]
max_factor = 1
for x in p_set:
if n % x == 0 and x > max_factor:
max_factor = x
print max_factor

[More programming riddles]

### Like this:

Like Loading...

*Related*