Challenge 3: Corresponding Fibonacci Number
Explore how to find the Fibonacci number at a given index by implementing a function using recursion. Understand the Fibonacci sequence pattern and its calculation, and apply this knowledge to solve coding problems involving recursion and iteration.
Problem Statement
Implement a function that takes a variable, testVariable, and finds the number that is placed at that index in the Fibonacci sequence.
What is the Fibonacci Sequence?
The Fibonacci sequence is one of the most famous formulas in mathematics. Each number in the sequence is the sum of the two numbers that precede it.
The sequence looks as follows:
$ 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 … $
Indexing begins at . Therefore, we have the element at index 0. At index , we have the element . At index we have the element , and so on.
Generic Mathematical Notation of Fibonacci Sequence
Any number (at index in the series) can be calculated using the following equation:
n n-2n-1 ...