solve :: Int
solve = sum [1000未満の3の倍数または5の倍数の整数]
-- 内包表記でうまく出来そう
solve = sum [ n | n <- [1..999], n `mod` 3 == 0 || n `mod` 5 == 0]
solve :: Int
solve = sum [ n | n <- [1..999], n `mod` 3 == 0 || n `mod` 5 == 0]
print solve
solve2 :: Int
solve2 = 3の倍数の和 + 5の倍数の和 - 15の倍数の和
sigma :: Int -> Int -> Int
sigma n k = n * k*(1 + k) / 2
-- 1000未満の場合の一般化
sigma_1000 :: Int -> Int
sigma_1000 n = sigma n (999 `div` n)
solve2 = sigma_1000 3 + sigma_1000 5 - sigma_1000 15
solve2 :: Int
solve2 = sigma_1000 3 + sigma_1000 5 - sigma_1000 15
sigma :: Int -> Int -> Int
sigma n k = n * k*(1 + k) `div` 2
sigma_1000 :: Int -> Int
sigma_1000 n = sigma n (999 `div` n)
print solve2