{{ message }}

Instantly share code, notes, and snippets.

# pedrosnk/problem1.erl

Created Jun 25, 2012
Learning Erlang
 % First Code Kata from http://projecteuler.net/problem=1 % 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(problem1). -export([populate_list/1]). -export([go/0]). populate_list(1) -> []; populate_list(Number) when (Number rem 3 == 0) or (Number rem 5 == 0) -> [Number] ++ populate_list(Number - 1); populate_list(Number) -> populate_list(Number - 1). go() -> lists:sum(populate_list(999)).
 -module(zomg). -export([fac/1]). -export([fib/1]). % This is a simple function for calculate a factorial of a number. fac(0) -> 1; fac(Number) -> Number * fac(Number - 1). % This is another simple one to calcula te the fibonacci sequence fib(0) -> 0; fib(1) -> 1; fib(Number) -> fib(Number -1) + fib(Number - 2).

### tuafeeqahmed commented Dec 30, 2016

 Can you write "money denomination" code in erlang Language ?