Recamán’s sequence viz
I’ve always liked cool visualizations, and this one really caught my eye in a Numberphile video about Recamán’s sequence. The sequence itself is simple but surprisingly beautiful: starting at 0, at each step n, try to subtract n from the current number. If the result is positive and hasn’t appeared before, use it, if not, add n instead. The result is a bouncy, non-repeating sequence full of visual rhythm.
In the video, Edmund Harriss draws the sequence as a series of connected semicircles, each number in the sequence arcs to the next, alternating up and down. In this notebook, I recreate that diagram programmatically using Python. It’s a fun way to explore how simple rules can lead to unexpectedly elegant patterns.