projects
/
sandbox
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Commit my random junk
[sandbox]
/
euler
/
elixir
/
0001-sum-of-multiples.exs
1
defmodule SumOfMultiples do
2
def is_multiple_of_3_or_5?(n) do
3
(rem(n, 3) == 0) or (rem(n, 5) == 0)
4
end
5
6
def run(limit) do
7
range = 0..(limit - 1)
8
filtered_range = Enum.filter(range, &(is_multiple_of_3_or_5?(&1)))
9
Enum.sum(filtered_range)
10
end
11
end
12
13
IO.puts(SumOfMultiples.run(1000))