Skip to content

Instantly share code, notes, and snippets.

@Macorreag
Created May 29, 2019 17:55
Show Gist options
  • Save Macorreag/1113a6b149853a5a01cacec8f4aa66db to your computer and use it in GitHub Desktop.
Save Macorreag/1113a6b149853a5a01cacec8f4aa66db to your computer and use it in GitHub Desktop.
fibonacci prolog recurcion hacia adelante
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