Skip to content

Instantly share code, notes, and snippets.

@sushant12
Last active May 12, 2020 02:17
Show Gist options
  • Save sushant12/af80670e7923f43c7e8d0dbe37d82c6b to your computer and use it in GitHub Desktop.
Save sushant12/af80670e7923f43c7e8d0dbe37d82c6b to your computer and use it in GitHub Desktop.
-module(assignment3).
-export([fib/1, pieces/1]).
fib(0) ->
0;
fib(1) ->
1;
fib(N) when N > 1 ->
fib(N - 2) + fib(N - 1).
pieces(1) ->
2;
pieces(N) when N > 0 ->
pieces(N-1) + N.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment