def euler_12(target): """ Here are 2 solutions to the problem. num_factors uses standard factorization, and num_factors2 uses prime factorization. The prime factorization method, when memoized, runs significantly faster in python. However, both methods are comparable when using pypy (~3.1 secs on a 1.6ghz core2 laptop) """ tempgen = (n for n in lib.triangle_gen() if num_factors_standard(n) > target) # tempgen = (n for n in lib.triangle_gen() if num_factors_via_prime(n) > target) return list(itertools.islice(tempgen, 0, 1))[0]
def euler_45(): triangles = filter(_filter, lib.triangle_gen()) return next(itertools.islice(triangles, 1))