Skip to content

Instantly share code, notes, and snippets.

@theraphim
Created October 29, 2015 16:58
Show Gist options
  • Save theraphim/ca813bb0056a149a8f4d to your computer and use it in GitHub Desktop.
Save theraphim/ca813bb0056a149a8f4d to your computer and use it in GitHub Desktop.
fib(0, A, _, A).
fib(N, A, B, F) :- N1 is N - 1, Sum is A + B, fib(N1, B, Sum, F), !.
fib(N, F) :- fib(N, 0, 1, F), !.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment