by dustingetz · 14y ago · 0 comments
we can use these ideas to elegantly solve the second greplin challenge question: "find the smallest prime fibonacci, X, greater than 227,000; compute sum of prime divisors of X+1"
pred = lambda x: x > 227000 and is_prime(x)
X = take(lazy_filter(pred, fib_gen()), 1)[0]
print sum(filter(is_prime, divisors(X+1)))
https://github.com/dustingetz/sandbox/blob/master/etc/grepli...No comments yet.