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
recaman(60)— This is a command. The name selects the routine, and the items inside the parentheses are its arguments.
Try a change
- Edit one number in the field, then use Generate Graph. The studio opens on the homepage with the edited text and runs it.
- Use Open in DGS Studio when you want the expression loaded but not run yet.
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.