challenges/e1/e1.erl

9 lines
280 B
Erlang

-module(e1).
-export([e1/0]).
sum_divisors(Max, Max, Acc) -> Acc;
sum_divisors(Start, Max, Acc) when Start rem 3 == 0; Start rem 5 == 0 -> sum_divisors(Start+1, Max, Acc+Start);
sum_divisors(Start, Max, Acc) -> sum_divisors(Start+1, Max, Acc).
e1() -> sum_divisors(2, 1000, 0).