Project Euler 410(3)

http://projecteuler.net/index.php?section=problems&id=410

別解法にしたら7分になった。さらにNumpyを使ったら22秒になった。