Search⌘ K

Example 2: The Fibonacci Series

Explore how to calculate the Fibonacci sequence using recursion. Understand the base cases for zero and one, then apply the recursive formula to compute further terms. This lesson helps you grasp recursive techniques essential for coding and AP Computer Science success.

We'll cover the following...

What is the Fibonacci sequence?

The Fibonacci sequence is a sequence in which each number is the sum of the two preceding ones, starting from 0 and 1. Mathematically:

F0=0,F1=1F_{0}= 0, F_{1} = 1
For n>1:n>1:
Fn=Fn1+Fn2
...