def primeFactors(n): """a list of prime factors of n""" result = [] upper_bound = 1 +int(n**0.5) # only have to seek to the square root searchList = primes(upper_bound) for divisor in searchList: if divides(divisor, n): result.append(divisor) result += primeFactors(int(n // divisor)) break # no factors found, so assume prime. if result == []: result.append(n) return result
def euler_p1(): return sum(filter(lambda x: divides(3,x) or divides(5,x), range(1000)))