RosettaCodeData/Task/Fibonacci-sequence/00DESCRIPTION

33 lines
1.4 KiB
Text
Raw Permalink Normal View History

2016-12-05 22:15:40 +01:00
The '''Fibonacci sequence''' is a sequence &nbsp; <big> F<sub>n</sub> </big> &nbsp; of natural numbers defined recursively:
2017-09-23 10:01:46 +02:00
<big><big> F<sub>0</sub> = 0 </big></big>
<big><big> F<sub>1</sub> = 1 </big></big>
<big><big> F<sub>n</sub> = F<sub>n-1</sub> + F<sub>n-2</sub>, if n>1 </big></big>
2016-12-05 22:15:40 +01:00
;Task:
Write a function to generate the &nbsp; <big> n<sup>th</sup> </big> &nbsp; Fibonacci number.
2013-04-10 21:29:02 -07:00
2015-02-20 00:35:01 -05:00
Solutions can be iterative or recursive (though recursive solutions are generally considered too slow and are mostly used as an exercise in recursion).
2013-04-10 21:29:02 -07:00
The sequence is sometimes extended into negative numbers by using a straightforward inverse of the positive definition:
2016-12-05 22:15:40 +01:00
<big><big> F<sub>n</sub> = F<sub>n+2</sub> - F<sub>n+1</sub>, if n<0 </big></big>
support for negative &nbsp; &nbsp; <big> n </big> &nbsp; &nbsp; in the solution is optional.
2013-04-10 21:29:02 -07:00
2017-09-23 10:01:46 +02:00
;Related tasks:
2016-12-05 22:15:40 +01:00
* &nbsp; [[Fibonacci n-step number sequences]]
2017-09-23 10:01:46 +02:00
* &nbsp; [[Leonardo numbers]]
2013-04-10 21:29:02 -07:00
;References:
2016-12-05 22:15:40 +01:00
* &nbsp; [[wp:Fibonacci number|Wikipedia, Fibonacci number]]
* &nbsp; [[wp:Lucas number|Wikipedia, Lucas number]]
* &nbsp; [http://mathworld.wolfram.com/FibonacciNumber.html MathWorld, Fibonacci Number]
* &nbsp; [http://www.math-cs.ucmo.edu/~curtisc/articles/howardcooper/genfib4.pdf Some identities for r-Fibonacci numbers]
* &nbsp; [[oeis:A000045|OEIS Fibonacci numbers]]
* &nbsp; [[oeis:A000032|OEIS Lucas numbers]]
<br><br>