Problem 190 – Project Euler

ラグランジュの未定乗数法を使うだけ.

import Data.Ratio ((%))
p :: (Integral a, Integral b) => a -> b
p m = floor.product $ [(2*n % (m+1))^n | n <- [1..m]]
p190 :: (Integral a, Integral b) => a -> b
p190 m = sum.map p $ [2..m]