Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (15 sloc) 0.54 kb
%% Problem
%% ---------------------
%% If we list all the natural numbers below 10 that are multiples of 3 or 5,
%% we get 3, 5, 6 and 9. The sum of these multiples is 23.
%%
%% Find the sum of all the multiples of 3 or 5 below 1000.
%% ---------------------
-module(p001).
-export([solve/0]).
-include_lib("eunit/include/eunit.hrl").
solve() -> lists:sum(multiples35(999)).
multiples35(N) ->
[ X || X <- lists:seq(1, N), (X rem 3 =:= 0) or (X rem 5 =:= 0) ].
multiples35_test() ->
?assertEqual(466, length(multiples35(999))).
Jump to Line
Something went wrong with that request. Please try again.