Fibonacci sequence: Difference between revisions

Content deleted Content added
{{header|Liberty BASIC}}
Markjreed (talk | contribs)
Define negative extension.
Line 5:
F<sub>n</sub> = F<sub>n-1</sub> + F<sub>n-2</sub>, if n>1
 
Write a function to generate the nth Fibonacci number. Solutions can be iterative or recursive (though recursive solutions are generally considered too slow and are mostly used as an exercise in recursion). Support for negative n is optional.
 
The sequence is sometimes extended into negative numbers by using a straightforward inverse of the positive definition:
 
F<sub>n</sub> = F<sub>n+2</sub> - F<sub>n+1</sub>, if n<0
 
Support for negative n in the solution is optional.
 
'''References:'''