Created
August 22, 2020 15:33
-
-
Save myaosato/8f04fdb54e51499eb71a6480a25e707d to your computer and use it in GitHub Desktop.
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
fib(N, F) :- fibo(0, 1, N, F). | |
fibo(A, _B, 0, F) :- F is A. | |
fibo(A, B, N, F) :- | |
N > 0, | |
NEWA is B, | |
NEWB is A + B, | |
NEWN is N - 1, | |
fibo(NEWA, NEWB, NEWN, F). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment