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