Created
May 29, 2019 17:55
-
-
Save Macorreag/1113a6b149853a5a01cacec8f4aa66db to your computer and use it in GitHub Desktop.
fibonacci prolog recurcion hacia adelante
This file contains hidden or 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(0,1). | |
fibo(1,1). | |
fibo(N,M):- +N>1,r(2,1,2,N,M). | |
r(I,B,_,N,B) :- I>N. | |
r(I,B,C,N,M) :- I=<N,I1 is I+1,D is C+B,r(I1,C,D,N,M). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment