Fibonacciberegner
Find the nth Fibonacci number and display the Fibonacci sequence up to that term.
Sådan bruges denne lommeregner
- Indtast n (term number, 1-based)
- Klik på knappen Beregn
- Læs resultatet vist under lommeregneren
The Fibonacci Sequence: Definition and Properties
The Fibonacci sequence is defined by: F(1) = 1, F(2) = 1, F(n) = F(n-1) + F(n-2) for n > 2. Each term is the sum of the two preceding terms: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ... Named after Italian mathematician Leonardo of Pisa (Fibonacci), who introduced it to Western mathematics in his 1202 book Liber Abaci, though the sequence was known in Indian mathematics centuries earlier.
The ratio of consecutive Fibonacci numbers converges to the golden ratio φ = (1 + √5)/2 ≈ 1.618. F(n+1)/F(n) → φ as n → ∞. This ratio appears in art, architecture, and nature. The closed-form expression (Binet's formula) is: F(n) = (φⁿ - ψⁿ)/√5, where ψ = (1-√5)/2 ≈ -0.618.
Fibonacci numbers have remarkable divisibility properties: GCD(F(m), F(n)) = F(GCD(m,n)). F(n) is divisible by F(m) whenever m divides n. The last digit of Fibonacci numbers repeats with period 60 (Pisano period for modulo 10), useful for quickly finding F(n) mod 10.
The Golden Ratio and Nature
The golden ratio φ ≈ 1.618 is one of mathematics' most celebrated constants. A rectangle is 'golden' when its sides are in ratio φ:1 — removing a square leaves another golden rectangle. This self-similarity continues infinitely, creating the golden spiral. This spiral approximates the logarithmic spiral found in nautilus shells, galaxies, and hurricanes.
In nature, Fibonacci numbers appear in: the number of petals on many flowers (3, 5, 8, 13 petals), the spiral arrangement of seeds in sunflowers and pine cones, the branching pattern of trees, and the arrangement of leaves (phyllotaxis) to maximize sun exposure. These patterns arise because Fibonacci arrangements minimize overlap and maximize packing efficiency during growth.
In art and architecture, the golden ratio appears in the Parthenon, Notre-Dame Cathedral, Leonardo da Vinci's Vitruvian Man, and many Renaissance paintings. Whether ancient artists consciously used the golden ratio or it's pattern-matching after the fact is debated among historians, but the mathematical properties are objectively beautiful.
Fibonacci in Computer Science and Algorithms
The naive recursive Fibonacci algorithm (fib(n) = fib(n-1) + fib(n-2)) is infamous for exponential time complexity O(2ⁿ) — fib(50) requires over 10¹² function calls. This makes it the canonical example for teaching memoization and dynamic programming: cache previously computed values to achieve O(n) time.
For very large Fibonacci numbers, matrix exponentiation achieves O(log n) time: [F(n+1), F(n); F(n), F(n-1)] = [1,1;1,0]ⁿ. This is useful in competitive programming and cryptography problems requiring F(10^18) mod p.
Fibonacci numbers also appear in: Fibonacci heaps (a priority queue with optimal amortized complexity), Zeckendorf's representation (every positive integer is uniquely a sum of non-consecutive Fibonacci numbers), and Fibonacci search (an algorithm similar to binary search). The Fibonacci sequence is woven throughout mathematics and algorithms in surprisingly deep ways.
💡 Vidste du?
- The Fibonacci sequence was documented in Indian mathematics as early as ~200 BC by Pingala, studying the patterns of long and short syllables in Sanskrit poetry.
- The ratio of consecutive Fibonacci numbers converges to the golden ratio φ ≈ 1.618, which appears in the spiral arrangement of seeds in sunflowers, scales in pinecones, and the arms of spiral galaxies.
- Leonardo Fibonacci introduced the sequence to Europe in his 1202 book "Liber Abaci," using it to model rabbit population growth — and transformed European mathematics by popularizing Hindu-Arabic numerals.
Sidst opdateret: March 2026
Frequently Asked Questions
What is F(1) — does the Fibonacci sequence start at 0 or 1?
There are two common conventions. This calculator uses F(1)=1, F(2)=1 (the classical Fibonacci sequence). Some sources use F(0)=0, F(1)=1 (the extended version). With the 0-indexed version, F(6)=8; with 1-indexed, F(6)=8 as well — they differ only in how n is counted.
What is the 50th Fibonacci number?
F(50) = 12,586,269,025. The sequence grows roughly by a factor of φ ≈ 1.618 with each term, so Fibonacci numbers grow exponentially.
Why do Fibonacci numbers appear in nature?
Fibonacci phyllotaxis (the arrangement of leaves, seeds, petals) arises from the golden angle (137.5°) between successive elements, which is derived from the golden ratio. This angle minimizes overlap, maximizes packing, and allows continuous growth — an evolutionarily optimal arrangement.