The Fibonacci sequence is a series where each number equals the sum of the two preceding numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... Starting with F(0) = 0 and F(1) = 1, the recurrence relation is F(n) = F(n-1) + F(n-2). This simple rule generates a sequence with remarkable mathematical properties appearing throughout nature, art, and mathematics. The sequence was introduced to Europe by Leonardo Fibonacci in 1202 when describing rabbit population growth, but the pattern was known in Indian mathematics centuries earlier.
Fibonacci numbers exhibit fascinating patterns and ratios. The ratio of consecutive Fibonacci numbers approaches the golden ratio φ (phi) ≈ 1.618: F(n+1)/F(n) → φ as n → ∞. For example, 21/13 ≈ 1.615, 34/21 ≈ 1.619, 89/55 ≈ 1.618. This connection to the golden ratio explains why Fibonacci spirals appear in nature (sunflower seeds, nautilus shells, galaxy arms) and why Fibonacci proportions are aesthetically pleasing in art and design. Every third Fibonacci number is even, every fourth is divisible by 3, and other divisibility patterns emerge at regular intervals.
Computing Fibonacci numbers can be done iteratively, recursively, or with closed-form formulas. Iterative computation (maintaining two previous values and summing) is O(n) time and O(1) space. Naive recursion (computing F(n-1) and F(n-2) recursively) is O(2^n) due to redundant calculations. Binet's formula provides closed-form computation: F(n) = (φ^n - ψ^n) / √5 where φ = (1+√5)/2 and ψ = (1-√5)/2, but floating-point errors limit accuracy. Matrix exponentiation computes F(n) in O(log n) time using [[1,1],[1,0]]^n.