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