Problem 190

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]
More Reading
Newer// tex 表
Older// Problem 191