Project Euler 379(2)

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

17着。1時間以上かかった。