number theory calculators

Fibonacci Calculator

Find the exact Fibonacci number at any position in the sequence. Use it to explore mathematical patterns, check algorithm results, or apply Fibonacci ratios in design.

About this calculator

The Fibonacci sequence is defined by the recurrence relation F(n) = F(n−1) + F(n−2), with seed values F(0) = 0 and F(1) = 1. Each term is simply the sum of the two preceding terms: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, … The calculator uses an iterative approach — starting with a = 0 and b = 1, it repeatedly sets temp = a + b, a = b, b = temp for n−1 steps — which runs in O(n) time without the memory overhead of recursion. An alternative closed-form expression is Binet's formula: F(n) = (φⁿ − ψⁿ) / √5, where φ = (1 + √5) / 2 ≈ 1.618 (the golden ratio) and ψ = (1 − √5) / 2. As n grows large, the ratio F(n+1) / F(n) converges to φ, which is why Fibonacci numbers appear in nature, art, and architecture.

How to use

Find the 10th Fibonacci number. Enter 10 in the Position (n) field. The calculator starts with a = 0, b = 1 and iterates 9 times: step 1 → b = 1; step 2 → b = 2; step 3 → b = 3; step 4 → b = 5; step 5 → b = 8; step 6 → b = 13; step 7 → b = 21; step 8 → b = 34; step 9 → b = 55. The result is F(10) = 55. You can verify: F(9) = 34 and F(8) = 21, and 34 + 21 = 55. Entering position 1 returns 1; entering 0 returns 0.

Frequently asked questions

What is the relationship between Fibonacci numbers and the golden ratio?

As you progress further along the Fibonacci sequence, the ratio of consecutive terms F(n+1) / F(n) converges to the golden ratio φ = (1 + √5) / 2 ≈ 1.6180339887. For example, F(10)/F(9) = 55/34 ≈ 1.6176, already very close. This connection is made exact by Binet's formula, which expresses F(n) directly in terms of φ. The golden ratio appears in art, architecture, and nature — including the spiral arrangement of sunflower seeds and nautilus shells — largely because of its tight link to Fibonacci growth.

Why do Fibonacci numbers appear in nature and plant growth?

Many plants produce leaves, petals, or seeds in Fibonacci quantities (3, 5, 8, 13 petals are common) because Fibonacci-based growth patterns maximise packing efficiency. When a plant adds new structures at a fixed angular offset of 360°/φ² ≈ 137.5° (the golden angle), each new element avoids overlapping previous ones as much as possible, letting the plant maximise sunlight exposure and seed density. This is not a mystical property but an outcome of optimisation under the constraint of adding one element at a time.

How can I find a Fibonacci number without calculating all previous terms?

Binet's formula gives F(n) directly: F(n) = (φⁿ − ψⁿ) / √5, where φ = (1 + √5)/2 and ψ = (1 − √5)/2. Because |ψ| < 1, the ψⁿ term becomes negligible for large n, so F(n) is simply the nearest integer to φⁿ / √5. This works perfectly for exact integer results up to moderate n, but floating-point precision limits accuracy for very large n. For exact large-n computation, matrix exponentiation — raising the 2×2 matrix [[1,1],[1,0]] to the nth power — gives a precise result in O(log n) steps.