Created
December 20, 2012 15:10
-
-
Save FabienArcellier/4345822 to your computer and use it in GitHub Desktop.
Calculate fibonacci suite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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