Fibonacci Sequence Generator
Generate the first N terms of the Fibonacci sequence. Shows the sequence, the nth term and the sum of all terms.
Γltimo termo (F)
Sum of all
Golden ratio (Ο)
β 1,6180
About the Fibonacci Sequence
The person who described this sequence was the mathematician Leonardo of Pisa, known as Fibonacci, back in the 13th century. You add the two preceding terms to reach the next one: 0, 1, 1, 2, 3, 5, 8, 13β¦ As it goes on, the ratio between two consecutive terms closes in on the golden ratio Ο β 1.618, a number that turns up in natural patterns, from flowers and shells to galaxies.
The Fibonacci sequence and the golden ratio
The Fibonacci sequence is defined recursively as Fβ = 0, Fβ = 1 and Fβ = Fβββ + Fβββ for n β₯ 2. The first terms are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144β¦ Binet's formula gives a closed form: Fβ = (ΟβΏ β ΟβΏ) / β5, where Ο = (1+β5)/2 β 1.618 is the golden ratio and Ο = (1ββ5)/2. The ratio Fβββ/Fβ converges to Ο. The sequence first appeared in Europe in the Liber Abaci (1202), where Leonardo of Pisa β Fibonacci β used it to model rabbit reproduction. Algorithmic notes: a naive recursive implementation runs in O(2βΏ) time (exponential, with many recomputed subproblems), iterative or memoized versions are O(n), and Binet's formula is O(1) but accumulates floating-point error for large n; matrix exponentiation gives O(log n).
Applications: nature, art and finance
Fibonacci numbers appear in nature (phyllotaxis β petal counts, spirals in sunflowers, pinecones and pineapples), art and architecture (Le Corbusier's Modulor), music (composers including BΓ©la BartΓ³k structured passages around Fibonacci ratios) and in technical analysis of financial markets (Fibonacci retracements: 23.6%, 38.2%, 61.8%).
FAQ
Does the sequence start at 0 or 1? The most common modern definition starts at Fβ = 0, Fβ = 1. Some older texts use Fβ = Fβ = 1; the values shift index by 1.
What is the golden ratio? The number Ο β 1.6180339β¦ satisfies ΟΒ² = Ο + 1. It is the limit of Fβββ/Fβ.
Why is naive recursion slow? Each call branches into two more, recomputing the same values exponentially many times. Memoization or iteration reduces it to linear time.
Are Fibonacci numbers really everywhere in nature? They appear often in phyllotaxis and spiral packings, but the "Fibonacci-in-everything" claim is overstated β many cases are coincidence or selection bias.
Related Tools
Rent Adjustment Calculator
Compute annual rent adjustment by IGP-M or IPCA accumulated in the last 12 months (manually configurable).
Pregnancy Calculator
Compute estimated due date (EDD), gestational age and trimester from the last menstrual period (LMP).
Fertile Period Calculator
Compute fertile window and ovulation day from the first day of the last cycle and the average cycle length.