Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

title Collatz Visualizations
emoji 🧊
colorFrom blue
colorTo yellow
sdk static
pinned false
license mit
short_description Interactive animations of the 3n+1 problem

Collatz Visualizations

Interactive, self-contained visualizations of the Collatz conjecture (the 3n+1 problem). Everything is plain HTML, CSS and vanilla JavaScript: no build step, no dependencies, and every orbit is computed live in the browser.

Live site: remifabre-collatz-visualizations.static.hf.space

The pages

Hailstone Atlas (index.html): seven chapters, from a single animated orbit to advanced structure.

  1. The Rule: one seed stepped through the rule on a log₂ altitude chart. Amber segments are odd steps (3n+1), cyan segments are even steps (n/2).
  2. The Collatz coral: the reverse Collatz tree grown as an organic form (a visual made famous by Edmund Harriss), with tunable branch angles and a tracer that lights up any seed's forward orbit as a path to the root.
  3. A thousand flights: seeds 2 to 1,000 overlaid, with flight-time record holders highlighted.
  4. Convergence rain: 2,000 seeds stepping in unison, with a live survival curve (the distribution of total stopping times).
  5. Stopping-time field: flight length for every seed up to 100,000. The rays are families of seeds whose trajectories merge.
  6. Spiral traffic: an Ulam spiral where each cell glows by how many trajectories (seeds up to 10,000) pass through it, with a second mode coloring each cell by its own flight length.
  7. The binary machine: trajectories as bit waterfalls. Halving deletes a bit; 3n+1 is a shift-and-add whose carry ripples are the hard part of the problem.

Hailstone Bestiary (bestiary.html): the same halving dynamics with the odd step changed. 3n−1 splits the integers between three attracting cycles, 5n+1 and 7n+1 send almost every seed past 2⁴⁵. Includes clickable fate maps and an orbit tracer. The one-number summary is the drift heuristic: a typical flight gains log₂(q) − 2 bits per odd step.

Hailstone Music Box (music-box.html): orbits sonified with the Web Audio API. Pitch follows log₂(n) snapped to C minor pentatonic; odd steps ring bright. Duet mode plays two seeds in stereo, so you hear the exact step where their trajectories merge. Seeds use BigInt, so arbitrarily large numbers play exactly.

Notes

  • Colors are semantic across all pages: warm amber for the 3n+1 rise, cold cyan for the halving fall. The categorical palettes are checked for color-vision-deficiency separation.
  • Pages respect prefers-reduced-motion: they load with completed, static renderings, and any replay/regrow/trace control re-enables animation on demand.
  • "Escape" in the Bestiary means an orbit was observed passing 2⁴⁵. Divergence is not proven for any single orbit of 5n+1 or 7n+1, just as convergence is not proven for every orbit of 3n+1.

License

MIT

About

Interactive animations of the Collatz 3n+1 problem: hailstone flights, Ulam-spiral traffic, binary machine, Collatz coral, sibling maps, sonification

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages