Jump to content

Fibonacci sequence: Difference between revisions

Add Datalog task
(Add Datalog task)
Line 3,219:
print(fibRec(11));
}</lang>
=={{header|Datalog}}==
Simple recurive implementation for Souffle.
<lang datalog>.decl Fib(i:number, x:number)
Fib(0, 0).
Fib(1, 1).
Fib(i+2,x+y) :- Fib(i+1, x), Fib(i, y), i+2<=40, i+2>=2.
Fib(i-2,y-x) :- Fib(i-1, x), Fib(i, y), i-2>=-40, i-2<0.</lang>
 
=={{header|DBL}}==
136

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.