Last active
November 1, 2016 07:57
-
-
Save MaroShim/6a6a7cf9dc86d2bd18a2a6c7ff031b76 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# less than 1000, multiple of 3 or 5 | |
defmodule Problem1 do | |
def solve(limit) do | |
1..(limit-1) | |
|> Enum.filter(fn x -> ((rem(x, 3) == 0) || (rem(x, 5) == 0)) end) | |
|> Enum.reduce(0, &(&1 + &2)) | |
end | |
def print do | |
IO.puts solve(1000) | |
end | |
end | |
Problem1.print |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment