fib(0, 0).
fib(1, 1).
fib
(N
, F
) :- X
is N
- 1, Y
is N
- 2, fib
(X
, A
), fib
(Y
, B
), F
is A
+ B
.
fib_sequence(A,B,[]) :- A > B.
fib_sequence
(A
,B
,[H
|T
]) :- A
=< B
, fib
(A
, H
), AA
is A
+ 1, fib_sequence
(AA
, B
, T
).
:- fib_sequence
(1,5,Output
), write(Output
).
ZmliKDAsIDApLgpmaWIoMSwgMSkuCmZpYihOLCBGKSA6LSBYIGlzIE4gLSAxLCBZIGlzIE4gLSAyLCBmaWIoWCwgQSksIGZpYihZLCBCKSwgRiBpcyBBICsgQi4KCmZpYl9zZXF1ZW5jZShBLEIsW10pIDotIEEgPiBCLgpmaWJfc2VxdWVuY2UoQSxCLFtIfFRdKSA6LSBBID08IEIgLCBmaWIoQSwgSCksIEFBIGlzIEEgKyAxLCBmaWJfc2VxdWVuY2UoQUEsIEIsIFQpLgoKOi0gZmliX3NlcXVlbmNlKDEsNSxPdXRwdXQpLCB3cml0ZShPdXRwdXQpLg==