Skip to main content
100%

Gist 0e347a46041a01aa3c4f

✓ Published0🌍 Public
CCBasis
Last edited Feb 5, 2016
Created on Feb 5, 2016

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 description

forked from <a href='http://bl.ocks.org/trinary/'>trinary</a>'s block: <a href='http://bl.ocks.org/trinary/9011649d262c27c6774b'></a>

Similar vizzes