Project Euler Problem 086
import Data.List -- 平方数かの判定 isq :: Integral a => a -> Bool isq n = n == r*r where r = floor $ sqrt $ fromIntegral n ans1 :: Maybe Int ans1 = findIndex (>(10^6)) $ scanl1(+) $ map r [0..] where r m= sum[a`quot`2 - if a>m then a-m-1 else 0 | a<-[1..m+m],isq (a*a+m*m)] --Just 1818 main = print ans1