DGS Studio

Sequences & Mathematical Patterns

Recamán Sequence

Explore alternating arcs with a step slider and animation.

recaman(60) draws the first 60 steps of Recamán's sequence. From the current value, the sequence tries to step backward by the next integer, and it steps forward when that backward landing spot is unavailable or negative.

The picture uses semicircular hops so a forward step and a backward step are easy to tell apart. The slider can stop the animation before step 60. The rule itself does not change with the slider.

Equation

recaman(60)

What the pattern rule is

Pattern examples make a discrete rule visible. Phyllotaxis places points at the golden angle. Recamán's sequence draws hops that stay on the smallest available integer. The Flower of Life repeats equal circles on a triangular lattice and clips them to a window.

The interesting structure is in the arrangement, not in a single y value. Changing the count changes how much of the pattern you see. The underlying rule stays the same, which makes these good pages for predicting the next step before you generate it.

Reading the input

Try a change

Generate Graph posts the expression to the studio graph engine and draws the result on the homepage. The editable field is the entire input, including every line.

Edit and generate

Generate Graph opens the studio homepage and runs this field. Open in DGS Studio loads the same text and waits for you to generate it. The equation is sent once, as a query parameter.

Related examples