Fibonacci Sequence Generator
Generate Fibonacci sequences, compute any Nth term with BigInt precision, and explore golden ratio convergence.
How to Use the Fibonacci Generator
- Sequence mode — enter how many terms you want (up to 500) and click Generate. The output uses BigInt so large numbers are exact.
- Nth Term mode — enter any index n and compute F(n) directly. F(1000) is a 209-digit number displayed in full.
- Golden Ratio mode — see a table of consecutive ratios F(n)/F(n-1) converging toward φ ≈ 1.6180339887 with visual precision bars.
The Fibonacci Sequence Explained
The Fibonacci sequence begins 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144… Each term is the sum of the two before it. The sequence is named after Leonardo of Pisa (nicknamed Fibonacci), who described it in his 1202 book Liber Abaci in the context of rabbit population growth. The sequence had been described centuries earlier by Indian mathematicians including Virahanka and Gopāla in the context of Sanskrit prosody.
The Golden Ratio Connection
Divide any Fibonacci number by the one before it: 5/3 = 1.667, 8/5 = 1.6, 13/8 = 1.625, 21/13 = 1.615, 34/21 = 1.619, 55/34 = 1.6176... The ratios oscillate above and below φ = 1.6180339887... and converge toward it rapidly. This relationship follows from the closed-form Binet's formula: F(n) = (φⁿ − ψⁿ) / √5, where ψ = (1 − √5)/2 ≈ −0.618. Since |ψ| < 1, ψⁿ → 0, so F(n) ≈ φⁿ / √5 for large n.
Fibonacci in Nature
The Fibonacci spiral — constructed by drawing quarter circles in squares whose sizes follow the sequence — approximates the golden spiral seen in nautilus shells. Sunflowers have 34 clockwise and 55 counterclockwise spirals of seeds, both Fibonacci numbers. Pinecone scales, pineapple skins, and artichoke leaves all display Fibonacci spiral patterns. This occurs because Fibonacci spacing minimizes packing waste — each new leaf or seed grows at approximately 137.5° (the golden angle, derived from φ) from the previous one, resulting in no two leaves directly above each other competing for sunlight.
Fibonacci in Computer Science
The Fibonacci sequence appears throughout algorithm analysis. Fibonacci heaps (a data structure) achieve better amortized complexity for priority queues. The Fibonacci search technique divides arrays using Fibonacci numbers rather than halving. The recursive Fibonacci function is the classic example of exponential time complexity (O(2ⁿ) naive) vs. efficient dynamic programming (O(n)), making it a standard teaching example for memoization and iterative solutions. Matrix exponentiation reduces Fibonacci computation to O(log n) time.
Fibonacci Numbers and Art
The golden ratio derived from Fibonacci appears throughout classical art and architecture. The Parthenon's facade dimensions approximate the golden rectangle. Leonardo da Vinci's illustrations for De Divina Proportione explore φ in human anatomy. Many painters, including Salvador Dalí, consciously used the golden spiral in their compositions. Whether or not these historical uses were intentional, the human perception system does find proportions near φ aesthetically pleasing — possibly because so much of the natural world follows these patterns.