Gist 0e347a46041a01aa3c4f
This example visualizes the Collatz conjecture by mapping each integer from 0 to 5199 to a small square, where the fill color encodes the number of cycles to reach 1 and the stroke color encodes the maximum value reached during the sequence. The squares are arranged in a grid, and hovering over a square updates a text label to show the exact cycle count and maximum for that number. The visualization uses D3.js (version 3.5.5) to compute the Collatz sequences, bind the data to SVG rectangles, and apply linear color scales with HSL interpolation for the two attributes. The layout positions squares sequentially in rows of fixed width, and the code notes that changing the width parameter alters the grid pattern.
AI-generated descriptionforked from <a href='http://bl.ocks.org/trinary/'>trinary</a>'s block: <a href='http://bl.ocks.org/trinary/9011649d262c27c6774b'></a>