fibonacci · bigint · golden ratio · local

Generate Fibonacci numbers

First N Fibonacci numbers via BigInt (no overflow). Shows the sum (= F(n+1) − 1) and the running ratio converging to φ.

Fibonacci Generator
N
20
terms
F(19)
4181
4 digits
Sum
10945
F(21) − 1
Ratio
1.618034055727554
φ ≈ 1.618034
Quick N
N (1-5000)
input · sequence size

F(0) = 0, F(1) = 1, F(n) = F(n−1) + F(n−2).

BigInt avoids overflow at any practical N.

Stat: Output size 213 B

output · sequence
F(0) = 0
F(1) = 1
F(2) = 1
F(3) = 2
F(4) = 3
F(5) = 5
F(6) = 8
F(7) = 13
F(8) = 21
F(9) = 34
F(10) = 55
F(11) = 89
F(12) = 144
F(13) = 233
F(14) = 377
F(15) = 610
F(16) = 987
F(17) = 1597
F(18) = 2584
F(19) = 4181
Quick Start

How Fibonacci works

Each term is the sum of the previous two. The ratio of consecutive terms approaches φ (the golden ratio) as n grows.

  1. 01

    Set N

    How many terms — 1 to 5000.

    Inputs are treated as UTF-8 throughout the pipeline and validated client-side as you type — nothing dispatches until the value is well-formed.

    Ninpututf-8client-sidevalidated
    N · text20 · set
    first 20 terms
    loaded · parsedclient-side
  2. 02

    Generate

    BigInt arithmetic keeps every digit.

    Each toggle re-computes through a memoised hook, so flipping options never resets your input and the UI stays snappy on large inputs.

    genoptionslivememoisedtoggles
    gen · memoisedexact · live
    0, 1, 1, 2, 3, 5, …
    options set · memoisedlive
  3. 03

    Check ratio

    F(n)/F(n−1) → φ ≈ 1.618…

    Randomness — where used — comes from crypto.getRandomValues, never Math.random. Heavy work sits in useMemo.

    phicomputeinstantlocaldeterministic
    ratio · instantφ · computed
    1.6180339887…
    computed · instantinstant
  4. 04

    Copy or download

    Whole list as one F(i) = … per line.

    Copy writes through navigator.clipboard and downloads use a Blob — zero network traffic. Same input plus same options always yield the same bytes.

    exportcopydownloadzero-networkreproducible
    ok · copiedready · copied
    Copied
    shipped · ready to shipsuccess
Pro tips

Pro tips for everyday utilities

Reach for crypto.getRandomValues

Cryptographically random for IDs, tokens, salts. Math.random is for animation and games, not security.

Sort IDs lexicographically

UUID v4 has no time ordering. Use ULID or UUID v7 if you need sorted IDs.

Mock data with seeds

Faker-style libraries can be seeded so tests are reproducible. Embed the seed in the fixture file.

Reference cards beat memory

Cheatsheets for Vim, Git, Docker, Linux signals are faster than man pages when you’re mid-flow.

Browser APIs vary

Touch events, gamepads, and clipboard differ across vendors. Feature-detect before use.

Persist in the right place

localStorage for user preferences, sessionStorage for transient state, IndexedDB for structured data.

Use Cases

When to look up Fibonacci

Algorithm interviews, demos, education.

Interview prep

Verify your DP or recursive solution against truth. Random values come from crypto.getRandomValues — cryptographically secure for tokens, salts, and session IDs. Math.random is deterministic enough for animations but predictable enough to be a security bug.

CSPRNG-backed

Visualization

Plot growth on a chart for talks. Pair with hashids, ULID, or UUID v7 when you need both random and sortable — useful for primary keys, public-facing IDs, and event log ordering without a sequence column.

reproducible

Number theory

Modular Fibonacci and Pisano periods. Output is deterministic given the same seed, so fixtures and tests stay reproducible across CI runs and contributor machines. Embed the seed in the fixture file for full replay.

snappy

Test fixtures

Predictable BigInt values for unit tests. Heavy work runs through useMemo so the UI stays snappy on large inputs. Same input + same options yields identical bytes — the kind of stability snapshot tests rely on.

feature-detected

Golden ratio demos

Show φ convergence interactively. Storage tools persist to the right backend: localStorage for user preferences, sessionStorage for transient state, IndexedDB for structured data. Pick the right shelf and quota worries disappear.

deterministic

Spirals

Use successive ratios for design grids. Browser feature detection: clipboard, fullscreen, gamepad, and Web Bluetooth APIs gracefully fall back when unavailable. No surprise white screens on Safari or older Firefox.

production-ready
FAQ

Frequently asked questions

F(0) = 0, F(1) = 1. Some sources start F(1) = 1, F(2) = 1 — we use the modern 0-indexed convention.
Past a few hundred digits the values become unreadable. We preview head+tail and offer Download for the full set.
Capped at 5000 to keep memory bounded. F(5000) has over 1000 digits — exact via BigInt.
Sum of F(0)..F(n) = F(n+2) − 1.
Yes — BigInt computation in your browser. Nothing is sent to a server.
Suggest a tool

Something missing?

Tell us what you need. We ship the top requests every two weeks.

Sent straight to the maintainers · no account needed
47 in queue·8 shipped this month
Request queued. Thanks!