Project Euler 408(2)

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

5分が53秒になった。既約剰余類群上での割り算に時間がかかっていたのだが、それが簡単なことで速くなった。