Project Euler 401

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

85着。よく考えたらいつものやつだった。Project Eulerで頻出のテクニック。
でも72秒もかかっている。