challenges/e1/e1.erl

9 lines
280 B
Erlang
Raw Normal View History

-module(e1).
-export([e1/0]).
2011-04-01 19:34:24 +00:00
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).
2011-04-01 19:34:24 +00:00
e1() -> sum_divisors(2, 1000, 0).