Skip to content

Instantly share code, notes, and snippets.

@sorah
Created April 5, 2009 05:59
Show Gist options
  • Save sorah/90385 to your computer and use it in GitHub Desktop.
Save sorah/90385 to your computer and use it in GitHub Desktop.
fibonacch on erlang.N=limit.(but start 2,5.if N=2,put a 1,1,2,5.)
-module(fib).
-export([f/1,f/4]).
f(N) -> io:put_chars("1\n1\n"),f(1,1,1,N).
f(E,F,X,N) ->
if X > -1 -> io:put_chars(integer_to_list(E + F)),
io:put_chars("\n"),
if X /= N -> f(F,E+F,X+1,N);
true -> ok
end;
true -> ok
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment