Collatz stopping times
O(n · k)The Collatz conjecture (unsolved since 1937) states that repeatedly applying the map m→m/2 (even) or m→3m+1 (odd) always eventually reaches 1. The total stopping time — the number of steps to reach 1 — varies wildly and has no known closed form. This visualiser computes the stopping time for each m in 2..n and assigns it to a colour band: tan for ≤10 steps, amber for 11–20 steps, and green for >20 steps, producing a striking heatmap. The cell labels show the exact step count.
Numbers
Edit the input and press Play
How it works
- Initialize all cells 2..n as candidates
- For each m compute its Collatz stopping time
- Assign colour band: ≤10 tan, 11–20 amber, >20 green
- Label each cell with its step count
Pseudocode
1collatzSteps(m): # steps to reach 12 steps = 03 while m != 1:4 m = m/2 if even else 3*m + 15 steps += 16 return steps78collatzGrid(n): # O(n * k)9 for m = 2 to n:10 s = collatzSteps(m)11 band[m] = "low" if s<=10 else "mid" if s<=20 else "high"