Fibonacci Sequence Generator

Generate Fibonacci numbers with index and comma-separated output.

Open tool

Overview

The Fibonacci Sequence Generator lists the first n Fibonacci numbers, each pair shown with its index, plus a comma-separated string ready to paste into code. The sequence starts 0, 1, 1, 2, 3, 5, 8, 13, 21, 34... and each term is the sum of the previous two.

It is built for programmers tinkering with iteration patterns, students learning recurrences, designers exploring proportions and anyone curious about a sequence that turns up everywhere from sunflowers to financial chart retracements.

How it works

The recurrence is F(0) = 0, F(1) = 1, F(n) = F(n - 1) + F(n - 2). The closed-form Binet formula F(n) = (φ^n - ψ^n) / sqrt(5) where φ = (1 + sqrt(5)) / 2 and ψ = 1 - φ gives any individual term in constant time, but for listing the whole sequence the iterative recurrence is simpler.

The generator uses arbitrary-precision integers under the hood, so terms beyond F(93) (the largest that fits in 64-bit signed) come out exactly rather than overflowing.

Examples

First 10 terms  →  0, 1, 1, 2, 3, 5, 8, 13, 21, 34
First 20 terms  →  0, 1, 1, 2, 3, 5, 8, 13, 21, 34,
                   55, 89, 144, 233, 377, 610, 987,
                   1597, 2584, 4181
F(50)  →  12,586,269,025
F(100)  →  354,224,848,179,261,915,075

FAQ

Does the sequence start with 0 or 1?

Both conventions exist. This tool starts with F(0) = 0, F(1) = 1, which is the most common modern definition.

How fast does it grow?

Each term is roughly φ ≈ 1.618 times the previous one, so the sequence grows exponentially. F(30) is already over 800,000.

Is the ratio of consecutive terms really the golden ratio?

In the limit, yes. F(n + 1) / F(n) converges to φ as n grows large.

Can I get terms before F(0)?

Yes — the recurrence extends backwards: F(-1) = 1, F(-2) = -1, F(-3) = 2, alternating signs. This tool focuses on non-negative indices.

Are there efficient ways to compute F(huge n)?

Yes — fast doubling computes F(n) in O(log n) multiplications using F(2k) = F(k) * (2 * F(k + 1) - F(k)) and F(2k + 1) = F(k)^2 + F(k + 1)^2.

Try Fibonacci Sequence Generator

An unhandled error has occurred. Reload ×