### Project Euler Challenge #3 : Finding Primes

Thursday, July 24th, 2014Finally, it gets interesting. Below is my third attempt on this problem, the first taking so long to complete that I improved it before its first iteration, and the second just wasn’t good enough.

def find_primes(number): """Returns a set of primes""" primes = set() if number != int(number): raise Exception('Must be int') # Improve this if number < 4: return primes i = 2 while number > 1: while number % i == 0: number = number / i primes.add(i) i += 1 return primes

In this solution, I learned some basic uses for python’s set builtin. I’m a better person today.