Fibonacci Numbers

Rumman Ansari   Software Engineer   2024-06-23 02:57:36   19 Share
Subject Syllabus DetailsSubject Details 2 Program
☰ Table of Contents

Table of Content:


Fibonacci Numbers: A sequence where each number is the sum of the two preceding ones, usually starting with 0 and 1. Example: 0, 1, 1, 2, 3, 5, 8.

The Fibonacci Sequence is the series of numbers:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...

The next number is found by adding up the two numbers before it:

  • the 2 is found by adding the two numbers before it (1+1),
  • the 3 is found by adding the two numbers before it (1+2),
  • the 5 is (2+3),
  • and so on!

It is that simple!

Here is a longer list:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,144,233,377,610,987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, ...

Can you figure out the next few numbers?


Makes A Spiral

When we make squares with those widths, we get a nice spiral:

Fibonacci Numbers

First, the terms are numbered from 0 onwards like this:

n = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ...
xn = 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 ...

So term number 6 is called x6 (which equals 8).

Example: the 8th term is
the 7th term plus the 6th term:


x8 = x7 + x6

fibonacci rule x_8 = x_7 + x_6

So we can write the rule:

The Rule is xn = xn−1 + xn−2

where:

  • xn is term number "n"
  • xn−1 is the previous term (n−1)
  • xn−2 is the term before that (n−2)

Example: term 9 is calculated like this:

x9= x9−1 + x9−2
 = x8 + x7
 = 21 + 13
 = 34