Vis. variations on Recamán sequence
This block presents seven animated visual variations of the Recamán sequence, showing paths drawn with different geometric shapes—circles, hexagons, losanges, squares, rounded squares, zed squares, and rounded pluses—derived from the same sequence of numbers. The main path animates via CSS keyframes using stroke-dashoffset, while thumbnails of each shape fade in sequentially and are clickable to switch the main visualization. Built with D3.js v5, the code computes the sequence programmatically and renders SVG paths with CSS animations for the reveal effect.
AI-generated descriptionThis block displays some visual variations on the Recamán sequence. Inspiration comes from the Numberphile's video The Slightly Spooky Recamán Sequence.
Here is how the Recamán sequence is computed :
a(0) = 0;
for n > 0:
a(n) = a(n-1) - n if positive and not already in the sequence,
a(n) = a(n-1) + n otherwise
Technically speaking, this block allows me to experiment path animation with CSS.
Acknowledgments to :
- D3.js (v.5)
- blockbuilder.org
- Numberphile's enlightments