Fibonacci Series in Python

What is Fibonacci Series?

Fibonacci Series is a pattern of numbers where each number is the result of addition of the previous two consecutive numbers.

Logic of Fibonacci Series

The next number is a sum of the two numbers before it. The 3rd element is (1+0) = 1 The 4th element is (1+1) = 2 The 5th element is (2+1) = 3

Fibonacci Series Formula

Hence, the formula for calculating the series is as follows: 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

Fibonacci Spiral

A Fibonacci spiral is a pattern of quarter-circles connected inside a block of squares with Fibonacci numbers written in each of the blocks.

Fibonacci Series Algorithm

Iterative Approach – Initialize variables a,b to 1 – Initialize for loop in range[1,n) # n exclusive – Compute next number in series; total = a+b ...