Project Euler 414

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

46着。
PyPyで33分。CPythonだと3倍くらいかかる。
14分になった。