Project Euler 422

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

38着。かかった時間は測定不能レベル。
地道に計算すればそんなに難しくない。