Problem 157

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

150番あたりの問題にしては簡単。

import Control.Monad
import Number
import Data.List
divisor100 n = [2^x*5^y | x <-[..2*n], y <- [..2*n]]
primitiveSolutions n = filter (uncurry (<=)) [(div (m^2) d + m, m + d) | d <- divisor100 n]
where m = 10^n
solutions = product.map (succ.length).group.factors.uncurry gcd
main = print.sum.map solutions.concatMap primitiveSolutions $[1..9]