Fibonacci Calculator

Find the nth Fibonacci number, check if a number is Fibonacci, or generate a sequence. Shows the golden ratio and exact digit count.

🌀 Fibonacci Calculator
n (term index)10
F(0)F(200)
F(n) Value
Digit Count
F(n)/F(n−1) → φ
Is Fibonacci?
Fibonacci Index

🌀 What is the Fibonacci Sequence?

The Fibonacci sequence is one of the most famous number sequences in mathematics: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ... Each number (called a Fibonacci number) is the sum of the two preceding numbers, starting from 0 and 1. This deceptively simple rule generates a sequence that appears throughout nature, art, and science in ways that have fascinated mathematicians for centuries.

The sequence was named after Leonardo of Pisa, known as Fibonacci, who introduced it to Western mathematics in his 1202 book Liber Abaci through a problem about rabbit population growth. However, Indian mathematicians including Virahanka and Hemachandra had described the sequence centuries earlier in the context of Sanskrit poetry meter. The sequence appears naturally in the arrangement of leaves (phyllotaxis), the number of spirals on sunflower heads (typically 34 and 55), pine cone bracts, and nautilus shell proportions.

A common misconception is that Fibonacci numbers are just a mathematical curiosity. In practice, Fibonacci retracement levels (23.6%, 38.2%, 61.8%) are among the most widely used tools in financial technical analysis. The Fibonacci heap data structure improves Dijkstra's shortest path algorithm. Fibonacci numbers arise in the time complexity of the Euclidean GCD algorithm (consecutive Fibonacci numbers are the worst case). They also connect deeply to the golden ratio φ ≈ 1.618, which appears in aesthetics, architecture, and biology.

This calculator handles three modes: find any specific Fibonacci number F(n) up to F(1000) (a 209-digit number) using JavaScript's BigInt for exact arithmetic; check whether any positive integer is a Fibonacci number by searching the sequence; and generate complete sequences between any two indices for tables and analysis.

📐 Formula

F(n) = F(n−1) + F(n−2)    with F(0) = 0, F(1) = 1
Binet's formula: F(n) = (φⁿ − ψⁿ) ÷ √5
φ = (1 + √5) / 2 ≈ 1.6180339887... (golden ratio)
ψ = (1 − √5) / 2 ≈ −0.6180339887...
Digit count: digits(F(n)) = ⌊n × log&sub1;&sub0;(φ)⌋ + 1 ≈ ⌊0.20898n⌋ + 1
Example: F(10) = F(9) + F(8) = 34 + 21 = 55

📖 How to Use This Calculator

Steps

1
Choose a mode - Select Nth Term to find F(n) for any index 0–1000, Check Number to test if a specific integer is a Fibonacci number, or Generate Sequence to list consecutive Fibonacci terms.
2
Enter the input - For Nth Term, type n or drag the slider (up to 200 on the slider, up to 1000 by typing). For Check Number, type any positive integer. For Sequence, enter the start and end indices (max 40 terms).
3
Read the results - For Nth Term, see the exact value (or digit count for large n), the number of digits, and the golden ratio approximation. The context window shows surrounding Fibonacci numbers.

💡 Example Calculations

Example 1 — Finding the 10th Fibonacci Number

What is F(10)?

1
Start from F(0)=0, F(1)=1 and iterate: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55
2
Verify: F(10) = F(9) + F(8) = 34 + 21 = 55
3
Golden ratio check: F(10)/F(9) = 55/34 ≈ 1.617647 (true φ ≈ 1.618034)
F(10) = 55  |  2 digits  |  F(n)/F(n−1) → 1.617647
Try this example →

Example 2 — Is 144 a Fibonacci Number?

Check: is 144 in the Fibonacci sequence?

1
Test: 5 × 144² − 4 = 5 × 20736 − 4 = 103676. Is this a perfect square? √103676 ≈ 321.99... No.
2
Test: 5 × 144² + 4 = 103684. √103684 = 322 exactly (322² = 103684) ✓
3
So 144 is a Fibonacci number. Counting up: ..., 89, 144, 233, ... → 144 = F(12).
144 = F(12)  |  Yes, it is a Fibonacci number!
Try this example →

Example 3 — Large Fibonacci: F(50)

What is F(50) and how many digits does it have?

1
Using BigInt iterative addition from F(0) to F(50).
2
F(50) = 12,586,269,025 (about 12.6 billion)
3
Digit count = 11. Golden ratio: F(50)/F(49) = 12,586,269,025 / 7,778,742,049 ≈ 1.61803399 (matches φ to 8 decimal places)
F(50) = 12,586,269,025  |  11 digits  |  Ratio ≈ 1.61803399
Try this example →

❓ Frequently Asked Questions

What is the Fibonacci sequence?+
The Fibonacci sequence is 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... where each term is the sum of the two before it. Formally, F(n) = F(n−1) + F(n−2) with F(0) = 0 and F(1) = 1. Named after Italian mathematician Leonardo Fibonacci (c. 1175–1250), who used it to model rabbit population growth in his 1202 work Liber Abaci.
What is the Fibonacci formula (Binet's formula)?+
Binet’s formula: F(n) = (φⁿ − ψⁿ) / √5, where φ = (1 + √5)/2 ≈ 1.618 and ψ = (1 − √5)/2 ≈ −0.618. Because |ψ| < 1, ψⁿ → 0, so F(n) = round(φⁿ / √5) for all n. However, floating-point errors accumulate for large n; this calculator uses BigInt iterative addition for exact results.
What is the golden ratio and its connection to Fibonacci?+
The golden ratio φ = (1 + √5)/2 ≈ 1.6180339887... is the positive root of x² = x + 1. It is the limit of F(n)/F(n−1) as n → ∞. This connection means consecutive Fibonacci numbers are the best rational approximations of φ. The sequence of ratios 1/1, 2/1, 3/2, 5/3, 8/5, 13/8, ... are the convergents of the continued fraction for φ.
How do Fibonacci numbers appear in nature?+
Fibonacci numbers appear in the spiral patterns of sunflower seeds (typically 34 clockwise and 55 counterclockwise spirals), pine cone bracts, pineapple scales, and artichoke leaves. The number of petals on many flowers is Fibonacci: lilies (3), buttercups (5), delphiniums (8), marigolds (13). This arises because Fibonacci growth patterns pack seeds or leaves most efficiently as the plant grows.
How do you know if a large number is a Fibonacci number?+
A positive integer m is Fibonacci if and only if 5m² + 4 or 5m² − 4 is a perfect square. For example, m = 89: 5(7921) + 4 = 39609 (not a perfect square), 5(7921) − 4 = 39601 = 199² ✓. So 89 is Fibonacci (it is F(11)). This elegant algebraic test works for any integer without listing the sequence.
What is Fibonacci retracement in finance?+
Fibonacci retracement is a technical analysis tool where horizontal lines are drawn at key Fibonacci ratios (23.6%, 38.2%, 50%, 61.8%, 78.6%) to identify potential support and resistance levels on a price chart. The 61.8% level comes from 1/φ and is called the “golden ratio retracement.” Traders use these levels to anticipate reversal points after significant price moves.
Why is F(0) = 0 instead of F(1) = 1?+
Starting from F(0) = 0 and F(1) = 1 (zero-indexed) is the mathematically standard convention. It ensures the identity F(m + n) = F(m)F(n+1) + F(m−1)F(n) holds for all non-negative integers, and aligns with the matrix formula [[1,1],[1,0]]^n = [[F(n+1),F(n)],[F(n),F(n−1)]]. Some textbooks use F(1) = 1, F(2) = 1 (one-indexed); this calculator uses zero-indexed (F(0) = 0).
What is the Pisano period?+
The Pisano period π(m) is the period of Fibonacci numbers modulo m. F(n) mod 2 repeats with period 3 (0,1,1,0,1,1,...). F(n) mod 10 (last digit) repeats with period 60. F(n) mod 1000 (last three digits) repeats with period 1500. The Pisano period enables computing F(very large n) mod m efficiently: find n mod π(m), then compute F at the reduced index.
How many digits does F(1000) have?+
F(1000) has 209 digits. Using the digit count formula: digits = ⌊1000 × log&sub1;&sub0;(φ)⌋ + 1 = ⌊1000 × 0.20898⌋ + 1 = ⌊208.98⌋ + 1 = 208 + 1 = 209. The exact value begins 4346655768693745643568852767504062580256466051737178040248172908953655541794905189040387984007925516929592259308032263477520968962323987332247116164299644090653318795707849700...and has 209 digits total.
What is the Fibonacci heap in computer science?+
A Fibonacci heap is a data structure (proposed by Fredman and Tarjan in 1987) that achieves amortized O(1) time for insert, find-minimum, decrease-key, and union operations, and O(log n) for delete-minimum. Its name comes from the fact that a tree of order k in a Fibonacci heap has at least F(k+2) nodes. Fibonacci heaps improve the theoretical running time of Dijkstra’s and Prim’s algorithms to O(E + V log V).

What is the Fibonacci sequence?

The Fibonacci sequence is 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... where each term is the sum of the two preceding terms. It starts with F(0) = 0 and F(1) = 1. Named after Leonardo of Pisa (Fibonacci), who introduced it to Europe in 1202, the sequence arises naturally in botany, art, financial markets, and number theory.

What is Binet's formula for Fibonacci numbers?

Binet's formula gives F(n) = (φⁿ − ψⁿ) / √5, where φ = (1 + √5)/2 ≈ 1.618 (golden ratio) and ψ = (1 − √5)/2 ≈ −0.618. For large n, |ψⁿ| < 0.5 so F(n) = round(φⁿ / √5). Binet's formula is elegant but loses precision for large n due to floating-point errors; iterative methods are used for n > 70.

What is the golden ratio and how does it relate to Fibonacci?

The golden ratio φ = (1 + √5)/2 ≈ 1.6180339887... As n increases, F(n)/F(n−1) → φ. For example: F(10)/F(9) = 55/34 ≈ 1.6176, F(20)/F(19) = 6765/4181 ≈ 1.61803. The golden ratio appears in art, architecture, and nature and is deeply connected to the Fibonacci sequence through this ratio property.

How do you check if a number is a Fibonacci number?

A positive integer m is a Fibonacci number if and only if 5m² + 4 or 5m² − 4 is a perfect square. For example: m = 13 → 5(169) + 4 = 849 (not perfect square) and 5(169) − 4 = 841 = 29² ✓, so 13 is F(7). This test works for any size integer without generating the whole sequence.

What are some real-world applications of Fibonacci numbers?

Fibonacci numbers appear in plant spiral patterns (sunflower seeds, pine cones, pineapple scales), stock market technical analysis (Fibonacci retracement levels at 23.6%, 38.2%, 61.8%), computer algorithms (Fibonacci heaps, Fibonacci search), music theory (octave intervals), and cryptography. The 61.8% level (1/φ) is widely used in trading as a support/resistance indicator.

What is the Pisano period?

The Pisano period π(m) is the period with which Fibonacci numbers repeat modulo m. For example, F(n) mod 2 repeats with period 3: 0, 1, 1, 0, 1, 1, ... F(n) mod 10 (last digit) repeats with period 60. The Pisano period is used in competitive programming to compute F(n) mod m for astronomically large n efficiently.

How many digits does the nth Fibonacci number have?

F(n) has ⌊n × log₁₀(φ)⌋ + 1 = ⌊0.20898n⌋ + 1 digits. So F(100) has about 21 digits, F(1000) about 209 digits, and F(10000) about 2090 digits. This is because F(n) ≈ φⁿ/√5, so log₁₀(F(n)) ≈ n × log₁₀(φ) − log₁₀(√5) ≈ 0.20898n − 0.349.

What is a Fibonacci spiral?

A Fibonacci spiral is constructed by drawing quarter-circle arcs through squares whose side lengths are consecutive Fibonacci numbers (1, 1, 2, 3, 5, 8, 13, ...). As the squares grow, the spiral approximates a golden spiral - one whose growth factor per quarter turn is φ. Fibonacci spirals appear in nautilus shells, galaxy arm patterns, and hurricane formations.

Are there negative Fibonacci numbers?

Yes - the sequence can be extended to negative indices using F(−n) = (−1)ⁿ⁺¹ F(n). So F(−1) = 1, F(−2) = −1, F(−3) = 2, F(−4) = −3, F(−5) = 5, ... This is called the negafibonacci sequence. The recurrence F(n−2) = F(n) − F(n−1) extends naturally to the left.

What is the fastest algorithm to compute large Fibonacci numbers?

The matrix exponentiation method computes F(n) in O(log n) matrix multiplications using the identity [[1,1],[1,0]]^n = [[F(n+1),F(n)],[F(n),F(n−1)]]. Combined with fast bignum arithmetic, this computes F(1,000,000) in under a second. For this calculator, simple iterative addition (O(n)) is used, which gives exact BigInt results up to F(1000).