For this year’s MathsJam gathering I made a cake that aimed to be a representation of the Recamán sequence. The sequence was made out of jelly lemon slices, leading to the frankly awful pun: Reclemon sequence. I don’t think the cake representation worked all that well, so I’d like to explain it here.

The Recamán sequence is defined as

\[ \begin{align}

& {{a}_{0}}=0 \\

& {{a}_{n}}=\left\{ \begin{array}{*{35}{l}}

{{a}_{n-1}}-n & \text{if this is positive and not already in the sequence} \\

{{a}_{n-1}}+n & \text{otherwise} \\

\end{array} \right. \\

\end{align}

\]

When plotted with the term number on the \(x\)-axis and the value on the \(y\)-axis the first 100 terms look like this.

A number can be in the sequence more than once if it is reached by moving in a positive direction on the second and subsequent times. For example, \(a_{20}=a_{24}=42\). It is not known if all positive integers will eventually appear in the sequence. In the first \(10^{230}\) terms, the first missing integer is 852 655.

The cake represented the first 29 terms of the sequence. It was inspired by the Numberphile video The Slightly Spooky Recamán Sequence, featuring Alex Bellos, and particularly by Edmund Harriss’s illustration of the first 65 terms as a spiral, as shown in the video.

Each row of lemon slices represents a term in the sequence. The number of slices is the same as the term number and the direction in which the slices are pointing shows if the term is reached by moving forwards or backwards. Each row starts at the previous term and finishes at the new term, so if there was a numberline running along the length of the cake you could read off the terms of the sequence by finding where the point of the last lemon slice in each row was on the numberline. This is made slightly more apparent using, er, digital lemon slices.

Odd-numbered terms are plotted above the \(x\)-axis and even-numbered terms are plotted below. Each term is plotted as close to the \(x\)-axis as it can be without overlapping any terms that are already plotted. As more terms are plotted, this leads to some nice patterns.

It also leads to a new sequence (the Reclemon sequence?) of the \(y\)-coordinates of each term. The first 30 terms are 0, 1, -1, 1, -2, 2, -1, 1, -2, 2, -3, 3, -4, 4, -5, 5, -6, 6, -1, 1, -2, 2, -3, 7, -7, 8, -8, 9, -9, 10. This also makes a nice pattern when plotted with the term number on the \(x\)-axis and the value on the \(y\)-axis.

Like the Recamán sequence, this new sequence bounces up and down in value. Unlike the Recamán sequence, it oscillates between positive and negative values. Because of the way the sequence is defined, we can be reasonably sure that every integer will eventually appear in it.