Home > Python > Python and Fibonacci

Python and Fibonacci

Well,  some posts ago I received a comment asking by the meaning of fibonacci, and now is time to explain fibonacci and learn more python.

OK, I will admit. In the first part of this post, I will be a lazy guy. Below the wikipedia definition of Fibonacci(but don’t worry, I will continue):

In mathematics, the Fibonacci numbers are the following sequence of numbers:

0,\;1,\;1,\;2,\;3,\;5,\;8,\;13,\;21,\;34,\;55,\;89, \ldots.

The first two Fibonacci numbers are 0 and 1, and each remaining number is the sum of the previous two:

\begin{align} 0 + 1 &= 1 \\ 1 + 1 &= 2 \\ 1 + 2 &= 3 \\ 2 + 3 &= 5 \\ 3 + 5 &= 8 \\ 5 + 8 &= 13 \\  &\;\vdots \end{align}

Some sources omit the initial 0, instead beginning the sequence with two 1s.

In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation

F_n = F_{n-1} + F_{n-2},\!\,

with seed values

F_0 = 0 \quad\text{and}\quad F_1 = 1.

The Fibonacci sequence is named after Leonardo of Pisa, who was known as Fibonacci (a contraction of filius Bonaccio, “son of Bonaccio”). Fibonacci’s 1202 book Liber Abaci introduced the sequence to Western European mathematics, although the sequence had been previously described in Indian mathematics.

OK? Easy no? :P   Let’s try with this link

Its a perfect way to understand how python works with Fibonacci.

Categories: Python Tags:
  1. Azuz
    April 3rd, 2009 at 12:16 | #1

    What if the seed values are 0 and 0 ?

  1. No trackbacks yet.