Fibonacci sequence: Difference between revisions
Content added Content deleted
(→{{header|Python}}: Rearranged iterative +/- to iterative section) |
Drkameleon (talk | contribs) |
||
Line 979: | Line 979: | ||
===Recursive=== |
===Recursive=== |
||
<lang arturo>fib: |
<lang arturo>fib: $[x][ |
||
if x<2 |
if? x<2 [1] |
||
else [(fib x-1) + (fib x-2)] |
|||
] |
|||
} |
|||
⚫ | |||
loop 1..25 [x][ |
|||
===Recursive with Memoization=== |
|||
print ["Fibonacci of" x "=" fib x] |
|||
⚫ | |||
<lang arturo>Fib $(memoize [x]{ |
|||
if x<2 { 1 }{ |
|||
$(Fib x-1) + $(Fib x-2) |
|||
} |
|||
})</lang> |
|||
=={{header|AsciiDots}}== |
=={{header|AsciiDots}}== |