Original article was published on Artificial Intelligence on Medium

## Mathematics

# The Fibonacci Sequence: An Algorithm for Perfection

## Fibonacci Series Explained Easily

Fibonacci was a 13th-century Italian mathematician who gave birth to one of the most notorious algorithms in mathematics.

In this article, I will explain its history, its mathematical importance, and finally, the code that I will run to replicate it.

# Count the Rabbits

Initially, Fibonacci created this mathematical model to win a competition run by Frederick II, a real authentic genius of the time. The math problem was the following:

**“There is a couple of rabbits in an enclosed space. Given that every month one couple is going to generate another couple that can become productive after one month, how many couples of rabbits can we count after 1 year?”**

Fibonacci solved the problem in this way and then published it in his book Liber Abaci, 1202.

## Step I

As you can see, the process is simple: to discover the number of rabbit couples in the second month, we begin by copying the Active number of couples of the first month in the Inactive spot of the second month: what it means is that each of the couples in Month 0 (1) has produced another couple that will remain Inactive for Month 1 (1).