Number Theory Visualizer
See the math behind algorithms, step by step
Number theory underpins cryptography, hashing and countless interview problems. These visualizers make the classic procedures tangible — watch the sieve cross out composites, the Euclidean algorithm shrink two numbers to their GCD, or the Collatz orbit bounce toward 1.
Browse Visualizers
Sieve of Eratosthenes Visualizer
Finds all primes up to n by crossing out multiples — O(n log log n).
Euclidean Algorithm (GCD) Visualizer
Computes the greatest common divisor by repeated remainder — O(log min(a,b)).
Prime Factorization Visualizer
Breaks a number into its prime building blocks.
Collatz Conjecture Visualizer
Halve evens, triple-and-add-one odds — watch the orbit reach 1.
Fibonacci Sequence Visualizer
Builds the Fibonacci sequence and its recursion tree.
Frequently asked questions
How does the Sieve of Eratosthenes work?
Starting from 2, it marks every multiple of each prime as composite; whatever stays unmarked is prime. It finds all primes up to n in about O(n log log n).
Why is the Euclidean algorithm so fast?
Each step replaces the larger number with the remainder of dividing the two, shrinking values quickly — O(log min(a, b)) time, only a handful of steps even for huge numbers.