Recamán's sequence explained

In mathematics and computer science, Recamán's sequence is a well known sequence defined by a recurrence relation. Because its elements are related to the previous elements in a straightforward way, they are often defined using recursion.

Recamán's sequence was named after its inventor, Colombian mathematician, by Neil Sloane, creator of the On-Line Encyclopedia of Integer Sequences (OEIS).__TOC__

Definition

Recamán's sequence

a0,a1,a2...

is defined as:

an=\begin{cases} 0&&ifn=0\\ an-n&&ifan-n>0andisnotalreadyinthesequence\\ an+n&&otherwise \end{cases}

The first terms of the sequence are:

0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, 22, 10, 23, 9, 24, 8, 25, 43, 62, 42, 63, 41, 18, 42, 17, 43, 16, 44, 15, 45, 14, 46, 79, 113, 78, 114, 77, 39, 78, 38, 79, 37, 80, 36, 81, 35, 82, 34, 83, 33, 84, 32, 85, 31, 86, 30, 87, 29, 88, 28, 89, 27, 90, 26, 91, 157, 224, 156, 225, 155, ...

Visual representation

The most-common visualization of the Recamán's sequence is simply plotting its values, such as the figure seen here.

On January 14, 2018, the Numberphile YouTube channel published a video titled "The Slightly Spooky Recamán Sequence", showing a visualization using alternating semi-circles, as it is shown in the figure at top of this page.

Sound representation

Values of the sequence can be associated with musical notes, in such that case the running of the sequence can be associated with an execution of a musical tune.[1]

Properties

The sequence satisfies:

an\geq0

|an-an-1|=n

This is not a permutation of the integers: the first repeated term is

42=a24=a20

.[2] Another one is

43=a18=a26

.

Conjecture

Neil Sloane has conjectured that every number eventually appears, but this has not been proven. As of 2026, terms have been calculated, and 852,655 is the smallest natural number to not appear on the list.

Uses

Besides its mathematical and aesthetic properties, Recamán's sequence can be used to secure 2D images by steganography.[3]

External links

Notes and References

  1. Web site: Play a Sequence . .
  2. Web site: Math less traveled . 2019-12-14 . 2023-07-11 . https://web.archive.org/web/20230711110214/https://mathlesstraveled.com/2016/06/12/the-recaman-sequence/ . dead .
  3. S. Farrag and W. Alexan, "Secure 2D Image Steganography Using Recamán's Sequence," 2019 International Conference on Advanced Communication Technologies and Networking (CommNet), Rabat, Morocco, 2019, pp. 1-6. doi: 10.1109/COMMNET.2019.8742368