Skip to main content
100%

Vis. variations on Recamán sequence

✓ Published0🌍 Public
KKcnarf
Last edited Jul 4, 2019
Created on Jun 20, 2018

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 description

This 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 :

mit Licensed

Similar vizzes