Project Euler 327(2)

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


手計算でC=3のときはわかった。しかし、M(4,6)がなかなか出ない。それがなんとか出た。難しい。