Fibonacci Visualizer — Build the Sequence
Animated Fibonacci sequence — each term is the sum of the previous two, built iteratively with step controls. Runs in your browser.
Pseudocode
Run an operation to see its steps.
Avg · Worst
How to use
- 1 Type how many terms (up to 30) and press Build sequence.
- 2 Each new term is the sum of the previous two — watch the two highlighted boxes add up.
- 3 Step back and forward, or use Random.
- 4 The sequence starts F(0) = 0, F(1) = 1.
Why use this tool
- See the Fibonacci sequence built iteratively in O(n) — no slow recursion.
- Watch each term form from the sum of the two before it.
- Understand why the iterative approach beats naïve recursion’s exponential time.
- Runs entirely in your browser. No signup, no uploads.
Frequently asked questions
What is the Fibonacci sequence?
A sequence where each number is the sum of the two preceding ones, starting 0, 1, 1, 2, 3, 5, 8, 13, 21, … It appears throughout mathematics and nature.
What is the time complexity of computing Fibonacci numbers?
The iterative method shown here is O(n) time and O(1) space. Naïve recursion is O(2ⁿ); memoized recursion (dynamic programming) is O(n).
Why is naïve recursive Fibonacci so slow?
It recomputes the same subproblems exponentially many times. Memoization or the iterative loop computes each term once, turning O(2ⁿ) into O(n).
What is the golden ratio’s connection?
The ratio of consecutive Fibonacci numbers F(n+1)/F(n) approaches the golden ratio φ ≈ 1.618 as n grows.
What is Fibonacci Sequence Visualizer?
A Fibonacci Sequence Visualizer builds the sequence iteratively, where each term F(i) = F(i-1) + F(i-2) starting from F(0)=0 and F(1)=1. It highlights the two terms being summed and the new term, in O(n) time.
Features
Step-by-step animation
Watch terms build up, and see the recursion tree's repeated subproblems.
Complexity
Naive recursion: O(φⁿ) exponential. Iterative / memoized: O(n) time, O(1) space.
100% private
Runs entirely in your browser — nothing is uploaded.
Example
Input
first 7 terms
Output
0, 1, 1, 2, 3, 5, 8 (F(6) = 8)
Common use cases
-
1
Motivate memoization
See why the recursion tree recomputes subproblems and how DP fixes it.
-
2
Learn the sequence
Understand the additive rule and its link to the golden ratio.
-
3
Recursion vs iteration
Compare exponential recursion against linear iteration.
Zerethon's Fibonacci visualizer animates how each term is the sum of the previous two (0, 1, 1, 2, 3, 5, 8, …) in your browser, illustrating both the exponential naive recursion and the linear iterative/memoized approach. Naive recursion is O(φⁿ) (≈ O(1.618ⁿ)); the iterative method is O(n) time and O(1) space.
- Category
- Algorithm
- Pricing
- Free
- Privacy
- Browser-based
- Signup
- Not required
References
- Fibonacci Number — Wolfram MathWorld — Wolfram MathWorld
- Fibonacci sequence — Wikipedia
Privacy
Your data never leaves your browser unless explicitly stated. Fibonacci Sequence Visualizer runs entirely client-side — no server upload, no logging, no tracking of your input.
New to this? Read the step-by-step explanation with Big-O analysis: Learn Dynamic Programming →
Related tools
Bubble Sort Visualizer
Animated bubble sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs entirely in your browser.
Open toolInsertion Sort Visualizer
Animated insertion sort with step controls, speed, custom input, live comparison/write counters and pseudocode. Runs in your browser.
Open toolSelection Sort Visualizer
Animated selection sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs in your browser.
Open toolMerge Sort Visualizer
Animated merge sort with step controls, speed, custom input, live comparison/write counters and pseudocode. Runs in your browser.
Open toolBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.