Skip to content

Instantly share code, notes, and snippets.

@thagomizer
Created March 21, 2014 01:36
Show Gist options
  • Save thagomizer/9677784 to your computer and use it in GitHub Desktop.
Save thagomizer/9677784 to your computer and use it in GitHub Desktop.
fib in prolog
fib(0,1).
fib(1,1).
fib(N,F):-
N > 1,
X is N - 2,
Y is N - 1,
fib(X,A),
fib(Y,B),
F is A + B.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment