Skip to content

Instantly share code, notes, and snippets.

@FabienArcellier
Created December 20, 2012 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FabienArcellier/4345822 to your computer and use it in GitHub Desktop.
Save FabienArcellier/4345822 to your computer and use it in GitHub Desktop.
Calculate fibonacci suite
fibo(1, Result):- Result is 1.
fibo(2, Result):- Result is 1.
fibo(X, Result):- X > 2, X1 is X - 1, X2 is X - 2, fibo(X1, ResultN1), fibo(X2, ResultN2), Result is ResultN1 + ResultN2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment