Share your repls and programming experiences

← Back to all posts
##### fibonacci

Under some older definitions, the value {\displaystyle F{0}=0}F{0}=0 is omitted, so that the sequence starts with {\displaystyle F{1}=F{2}=1,}{\displaystyle F{1}=F{2}=1,} and the recurrence {\displaystyle F{n}=F{n-1}+F{n-2}}{\displaystyle F{n}=F{n-1}+F{n-2}} is valid for n > 2.[3] In his original definition, Fibonacci started the sequence with {\displaystyle F{1}=1,F{2}=2}{\displaystyle F{1}=1,F{2}=2}[5]

The Fibonacci spiral: an approximation of the golden spiral created by drawing circular arcs connecting the opposite corners of squares in the Fibonacci tiling; (see preceding image)
Fibonacci numbers are strongly related to the golden ratio: Binet's formula expresses the nth Fibonacci number in terms of n and the golden ratio, and implies that the ratio of two consecutive Fibonacci numbers tends to the golden ratio as n increases.

Fibonacci numbers are named after the Italian mathematician Leonardo of Pisa, later known as Fibonacci. In his 1202 book Liber Abaci, Fibonacci introduced the sequence to Western European mathematics,[6] although the sequence had been described earlier in Indian mathematics,[7][9] as early as 200 BC in work by Pingala on enumerating possible patterns of Sanskrit poetry formed from syllables of two lengths.

Fibonacci numbers appear unexpectedly often in mathematics, so much so that there is an entire journal dedicated to their study, the Fibonacci Quarterly. Applications of Fibonacci numbers include computer algorithms such as the Fibonacci search technique and the Fibonacci heap data structure, and graphs called Fibonacci cubes used for interconnecting parallel and distributed systems.

They also appear in biological settings, such as branching in trees, the arrangement of leaves on a stem, the fruit sprouts of a pineapple, the flowering of an artichoke, an uncurling fern, and the arrangement of a pine cone's bracts.

Fibonacci numbers are also closely related to Lucas numbers {\displaystyle L{n}}L{n}, in that the Fibonacci and Lucas numbers form a complementary pair of Lucas sequences: {\displaystyle U{n}(1,-1)=F{n}}U{n}(1,-1)=F{n} and {\displaystyle V{n}(1,-1)=L{n}}V{n}(1,-1)=L{n}.