Project Euler 391(1)

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

M(100)に0.8秒もかかっている。考え直さないと。