Project Euler 412(2)

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

あれこれ工夫して0.25秒になった。Pythonではこれが限界ということにする。