Skip to content

Instantly share code, notes, and snippets.

@mmitou
Created October 1, 2012 08:44
Show Gist options
  • Save mmitou/3810373 to your computer and use it in GitHub Desktop.
Save mmitou/3810373 to your computer and use it in GitHub Desktop.
project euler 1
-- 10未満の自然数のうち、3 もしくは 5 の倍数になっているものは 3, 5, 6, 9 の4つがあり、 これらの合計は 23 になる。
-- 同じようにして、1,000 未満の 3 か 5 の倍数になっている数字の合計を求めよ。
euler1 = sum $ filter (\n -> n `mod` 3 == 0 || n `mod` 5 == 0) [1..999]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment