Jump to content

Fibonacci sequence: Difference between revisions

m
(→‎{{header|Python}}: Rearranged iterative +/- to iterative section)
Line 979:
===Recursive===
 
<lang arturo>fib: @($[x){][
if? x<2 { [1 }{]
else [(fib x-1]) + [(fib x-2)]
]
}
}</lang>
 
loop 1..25 [x][
===Recursive with Memoization===
print ["Fibonacci of" x "=" fib x]
 
}]</lang>
<lang arturo>Fib $(memoize [x]{
if x<2 { 1 }{
$(Fib x-1) + $(Fib x-2)
}
})</lang>
 
=={{header|AsciiDots}}==
1,532

edits

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