Skip to main content
🔬 Advanced ✨ New

Fibonacci Calculator

Find the nth Fibonacci number and display the Fibonacci sequence up to that term. This free online math calculator gives you instant step-by-step results.

★★★★★ 4.8/5 · 📊 0 calculations · 🔒 Private & free

What Is the Fibonacci Sequence?

The Fibonacci sequence is one of the most famous number patterns in mathematics. It is defined by a simple recurrence relation: each number is the sum of the two preceding numbers. The classical sequence (1-indexed) begins: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584 …

Formally: F(1) = 1, F(2) = 1, F(n) = F(n−1) + F(n−2) for all n > 2. An alternate convention starts with F(0) = 0, F(1) = 1, shifting the index by one. Both are valid; this calculator uses the 1-indexed (classical) convention.

The sequence is named after Leonardo of Pisa, known as Fibonacci, who introduced it to Western mathematics in his 1202 book Liber Abaci (Book of Calculation). He used it to model idealized rabbit population growth: start with one pair, each pair produces one new pair each month after a one-month maturation period, and rabbits never die. After n months, you have F(n) pairs. This was a pedagogical example, not a realistic ecological model — but it launched one of the most studied sequences in all of mathematics.

Fibonacci Sequence Table: First 30 Terms

Here are the first 30 Fibonacci numbers for quick reference. Notice how quickly the values grow — this is characteristic of exponential-like growth.

nF(n)nF(n)nF(n)
1111892110,946
21121442217,711
32132332328,657
43143772446,368
55156102575,025
681698726121,393
713171,59727196,418
821182,58428317,811
934194,18129514,229
1055206,76530832,040

F(50) = 12,586,269,025. F(100) = 354,224,848,179,261,915,075. These numbers grow approximately as φⁿ/√5, where φ = (1+√5)/2 ≈ 1.618 (the golden ratio). The ratio of consecutive Fibonacci numbers converges to φ: F(21)/F(20) = 10946/6765 ≈ 1.61803...

The Golden Ratio and Fibonacci Numbers

The golden ratio φ (phi) = (1 + √5)/2 ≈ 1.6180339887... is the limit of the ratio F(n+1)/F(n) as n approaches infinity. This connection is one of the most beautiful relationships in mathematics — a simple integer sequence converges to an irrational constant that appears throughout geometry, art, and nature.

Binet's closed-form formula gives the nth Fibonacci number directly without recursion:

F(n) = (φⁿ − ψⁿ) / √5, where ψ = (1−√5)/2 ≈ −0.618

Since |ψ| < 1, the term ψⁿ/√5 becomes negligible for large n, meaning F(n) ≈ φⁿ/√5 rounded to the nearest integer. For n = 10: φ¹⁰/√5 = 55.0036... → rounds to 55. ✓

The golden ratio appears in:

Fibonacci Numbers in Nature

Fibonacci numbers appear with striking frequency in natural growth patterns. This is not coincidence — these patterns emerge from the mathematics of efficient packing and continuous growth.

Natural PatternFibonacci ConnectionExample Values
Flower petalsMost flowers have F(n) petalsButtercup: 5, Delphinium: 8, Marigold: 13, Daisy: 21 or 34
Sunflower seed spiralsClockwise and counterclockwise spiral counts are consecutive Fibonacci numbersTypically 34 and 55, or 55 and 89
Pine cone spiralsTwo sets of spirals in Fibonacci numbers5 and 8, or 8 and 13
Pineapple scalesThree sets of spirals5, 8, and 13
Leaf arrangement (phyllotaxis)Leaves grow at golden angle (137.5°) apartMaximizes sunlight exposure
Romanesco broccoliSelf-similar spiral structure with Fibonacci countsVisible fractal Fibonacci spirals
Nautilus shellLogarithmic spiral approximating golden spiralGrowth ratio ≈ φ per quarter-turn

The golden angle — 360° × (1 − 1/φ) ≈ 137.5° — is the angle between successive leaf or seed primordia in optimal phyllotaxis. Growing a new leaf at 137.5° from the previous one means no two leaves are ever at the same angle, maximizing access to sunlight and rain. This optimal angle is determined by the golden ratio, which is determined by Fibonacci numbers. Nature evolves toward mathematical efficiency.

Fibonacci Numbers in Computer Science

The Fibonacci sequence is foundational in computer science education and algorithm design. The naive recursive implementation is the canonical example of exponential time complexity and the power of memoization.

Naive recursion (bad): fib(n) = fib(n-1) + fib(n-2). This computes fib(n-2) many redundant times. Computing fib(50) requires over 10¹² function calls — billions of redundant computations. Time complexity: O(2ⁿ).

Dynamic programming (good): Store previously computed values. Computing fib(n) requires exactly n−1 additions. Time complexity: O(n), space: O(n) or O(1) with rolling variables.

Matrix exponentiation (best for huge n): The identity [F(n+1), F(n); F(n), F(n-1)] = [1,1;1,0]ⁿ allows computing F(n) in O(log n) time using fast matrix exponentiation. This is essential for competitive programming problems like "find F(10¹⁸) mod 10⁹+7."

Fibonacci numbers also appear in:

Divisibility Properties and Number Theory

Fibonacci numbers have remarkable number-theoretic properties that make them useful in cryptography and mathematical research:

Historical Background and Cultural Significance

The sequence now known as Fibonacci numbers was first described in Indian mathematics. The Sanskrit scholar Pingala (c. 300–200 BC) studied the combinatorics of Sanskrit poetry, specifically the number of ways to arrange long (2-beat) and short (1-beat) syllables to fill a verse of n beats. His analysis yielded the Fibonacci numbers implicitly. The mathematician Virahanka (c. 600–800 AD) and later Hemachandra (1150 AD) described the sequence explicitly in the context of Hindi poetry meter.

In Europe, Leonardo of Pisa (Fibonacci) introduced the sequence in Liber Abaci (1202) using the rabbit population problem. More importantly, this book introduced Hindu-Arabic numerals (0-9) to Europe, replacing the cumbersome Roman numeral system. Fibonacci's contribution to mathematics extends far beyond his famous sequence — he revolutionized European arithmetic and made the development of algebra and calculus possible.

The connection to the golden ratio was formalized by mathematicians in the 16th and 17th centuries. Johannes Kepler noted that consecutive Fibonacci numbers approach the golden ratio. The sequence received its modern name in 1877 when French mathematician Édouard Lucas (who also gave us the related Lucas numbers: 2, 1, 3, 4, 7, 11, 18, 29...) named them after Fibonacci.

Fibonacci Numbers in Finance and Trading

Technical analysts in financial markets use Fibonacci ratios to identify potential support and resistance levels. "Fibonacci retracements" are horizontal lines at key levels derived from the Fibonacci sequence:

Fibonacci LevelCalculationInterpretation
23.6%F(n)/F(n+3) → 1/φ³Shallow retracement level
38.2%F(n)/F(n+2) → 1/φ²Common support/resistance
50.0%Not strictly FibonacciPsychological midpoint
61.8%F(n)/F(n+1) → 1/φThe "golden ratio" level
78.6%√(61.8%)Deep retracement level

Whether Fibonacci levels have genuine predictive power in markets is debated among academics — many studies suggest they perform no better than random levels. However, their widespread use creates self-fulfilling prophecies: because many traders watch these levels, price reactions at them become more likely. The mathematics is elegant; the trading application is psychological as much as mathematical.

Frequently Asked Questions

What is F(1) — does the Fibonacci sequence start at 0 or 1?

This calculator uses the classical convention: F(1)=1, F(2)=1. Some sources use the extended convention: F(0)=0, F(1)=1. Both give the same values for F(n) when n≥1; they differ only in how n is counted. The 0-indexed version is convenient in computer science (zero-based arrays), while the 1-indexed version reflects the original historical formulation.

What is the 50th Fibonacci number?

F(50) = 12,586,269,025. The sequence grows approximately as φⁿ/√5, where φ ≈ 1.618. Since φ¹⁰ ≈ 122.99, the numbers roughly multiply by 122-123 every 10 steps: F(50) ≈ F(40) × 123 ≈ 102,334,155 × 123 ≈ 12.6 billion.

Why do Fibonacci numbers appear in nature?

Fibonacci phyllotaxis arises because growing organs (leaves, seeds, petals) form sequentially, each at the golden angle (≈137.5°) from the previous one. The golden angle is the only angle that never produces a "spoke" pattern — it maximizes the number of distinct radial directions, which maximizes light and nutrient access. The connection to Fibonacci numbers comes from the fact that the golden ratio is the most "irrational" number, meaning it converges slowest when expressed as a continued fraction, ensuring optimal angular spacing.

Is the Fibonacci sequence the same as the Lucas sequence?

No, but they are closely related. The Lucas sequence uses the same recurrence relation (L(n) = L(n-1) + L(n-2)) but starts with L(1)=1, L(2)=3: 1, 3, 4, 7, 11, 18, 29, 47... The ratio of consecutive Lucas numbers also converges to φ. They satisfy: L(n) = F(n-1) + F(n+1) and F(2n) = F(n)·L(n).

What is Binet's formula?

Binet's formula gives the nth Fibonacci number directly: F(n) = (φⁿ − ψⁿ)/√5, where φ = (1+√5)/2 ≈ 1.618 and ψ = (1−√5)/2 ≈ −0.618. Since |ψ| < 1, ψⁿ→0 as n→∞, so F(n) is the nearest integer to φⁿ/√5 for all n≥1. This formula converts a recursive definition into a closed-form (direct calculation) formula.

Are there Fibonacci numbers in Pascal's triangle?

Yes! If you sum the shallow diagonals of Pascal's triangle (going from bottom-left to top-right), the sums are Fibonacci numbers: 1, 1, 2, 3, 5, 8, 13... This is one of many surprising connections between Fibonacci numbers and other areas of combinatorics.

What is the Pisano period?

The Pisano period π(m) is the period with which Fibonacci numbers repeat modulo m. π(10) = 60 (last digit repeats every 60 terms), π(100) = 300 (last two digits repeat every 300 terms). Pisano periods allow computing F(n) mod m for astronomically large n efficiently, important in cryptographic applications.

Can Fibonacci numbers be negative?

The sequence can be extended to negative indices: F(-n) = (-1)^(n+1) × F(n). So F(-1)=1, F(-2)=-1, F(-3)=2, F(-4)=-3, F(-5)=5... The absolute values are the same Fibonacci numbers, with alternating signs for even negative indices. This extension, called the negafibonacci sequence, maintains the recurrence relation.

How large can this calculator compute?

This calculator works up to F(80) = 23,416,728,348,161,557,424 using standard JavaScript floating-point arithmetic. For larger values, JavaScript's number precision is insufficient without special big-integer libraries. For exact values of F(n) for large n, use Python's arbitrary-precision integers or a specialized big number library.

What is Zeckendorf's theorem?

Every positive integer has a unique representation as a sum of non-consecutive Fibonacci numbers. For example: 10 = 8 + 2 = F(6) + F(3); 11 = 8 + 3 = F(6) + F(4); 20 = 13 + 5 + 2 = F(7) + F(5) + F(3). No two adjacent Fibonacci numbers appear in the sum. This is Zeckendorf's representation and has applications in data compression (Fibonacci coding).

Fibonacci Sequence and Music Theory

Surprisingly, Fibonacci numbers appear in music theory and composition. The musical scale contains 13 notes from an octave to the next; an octave spans 8 notes; a chord is built on the 1st, 3rd, and 5th notes of a scale (positions 1, 3, 5 — all Fibonacci numbers). An octave contains 5 whole-tone and 2 semitone black keys on a piano keyboard, in a pattern of 2 and 3 (consecutive Fibonacci numbers).

Several composers have deliberately used Fibonacci structure in their works. Béla Bartók's "Music for Strings, Percussion and Celesta" (1936) has structural proportions reflecting Fibonacci numbers. Debussy and Satie used Golden Section proportions in determining climax points in their compositions. Whether these were conscious decisions or post-hoc analysis is debated, but the mathematical structure in music is real and beautiful.

In contemporary music, Fibonacci rhythms appear in progressive rock (Tool's "Lateralus" is famously structured around Fibonacci numbers in syllable counts), electronic music, and experimental composition. The sequence provides a natural way to create rhythmic complexity that feels organic rather than arbitrary.

Fibonacci Identities and Useful Formulas

The Fibonacci sequence has hundreds of known identities. Here are the most useful for calculations:

IdentityFormulaExample
Cassini's identityF(n+1)·F(n-1) − F(n)² = (-1)ⁿF(4)·F(2) − F(3)² = 3·1 − 4 = -1
Sum of first n termsΣ F(i) for i=1..n = F(n+2) − 11+1+2+3+5=12 = F(7)−1 = 13−1 ✓
Sum of squaresΣ F(i)² for i=1..n = F(n)·F(n+1)1+1+4+9+25=40 = F(5)·F(6) = 5·8 ✓
Even-indexed termsF(2n) = F(n)·(2F(n+1) − F(n))F(6) = F(3)·(2F(4) − F(3)) = 2·(6−2) = 8 ✓
Doubling formulaF(2n+1) = F(n)² + F(n+1)²F(7) = F(3)²+F(4)² = 4+9 = 13 ✓

These identities are invaluable in competitive programming, where computing Fibonacci numbers modulo a prime often requires fast exponentiation using the matrix or doubling method rather than simple iteration. The doubling method computes F(2n) and F(2n+1) from F(n) and F(n+1), halving the number of required operations at each step.

},{"@type":"Question","name":"What is the 50th Fibonacci number?","acceptedAnswer":{"@type":"Answer","text":"F(50) = 12,586,269,025. The sequence grows roughly by a factor of φ ≈ 1.618 with each term, so Fibonacci numbers grow exponentially."}},{"@type":"Question","name":"Why do Fibonacci numbers appear in nature?","acceptedAnswer":{"@type":"Answer","text":"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."}}]}