Fibonacci sequence

261 views

Can someone please explain the concept and theory behind this?? I’ve heard alot of nature and bees all add up to the ratio but im so confused as to why and whats the purpose.

In: 9

7 Answers

Anonymous 0 Comments

The Fibbonacci sequence is a recursive formula. It’s defined by itself. For any given index in the sequence, add up the two prior numbers in the sequence, but start with two 1s.

The sequence is this, for the first bunch:

1 1 2 3 5 8 13 21 34 55

Fib of 4 would be the fourth number in the sequence, 3, because it begins with two 1s. But how would you calculate it?

This is the formula:

* Fib(x) = Fib(x-1) + Fib(x-2)
* Fib(1) = 1
* Fib(2) = 1

Note the two extras. You can’t actually find Fib(4) without also finding Fib(3) and Fib(2) because that’s what “recursive” means: you need to use the formula *within itself* to calculate a value. The “recursion” stops once you hit a “base case”. That is, a known value for a given input. We know that if we give it 1 or 2 we get back 1 (because the Fibonacci sequence has simply been defined that way), so the “recursion” will finally stop. Calculating the Fibonacci sequence is kinda like going backwards until you hit those two 1s, and then you go forward again (and a lot of recursive functions are like this).

Fib(4) = Fib(3) + Fib(2)

Ok, what’s Fib(3)?

Fib(3) = Fib(2) + Fib(1)

Thankfully, we already have values for Fib(2) and Fib(1): they’re both 1.

Fib(3) = 1 + 1 = 2

So now let’s plug those back in to Fib(4).

Fib(4) = 2 + 1 = ***3***

If you just start with two 1s, you should be able to go as high as you want. What number would come after 55? 89, because that’s the result of 34 + 55.

You are viewing 1 out of 7 answers, click here to view all answers.