Project Euler Problem 028
zobun :: [Int] zobun = concatMap(\x->x:[x]) [1..4010] accum :: [Int] accum = scanl1 (+) (1:zobun) nlist :: Int -> [Int] nlist n = take (2*n) accum nsum :: Int -> Int nsum n = (sum $ nlist n) - 2 - (quot n 2) --うしろの数値は手作業で予想 ans1 :: Int ans1 = nsum 1001 --669171001 main :: IO () main = print ans1