TOPICS
Search

Recamán's Sequence


RecamansSequence

The name "Recamán's sequence" refers to at least two integer sequences attributed to B. Recamán (Sloane 1999). One is the sequence a_n formed by taking a_1=1 and, for n>=2, letting

 a_n={a_(n-1)-n   if a_(n-1)-n>0 and has not occurred previously; a_(n-1)+n   otherwise,
(1)

which can be succinctly defined as "subtract if you can, otherwise add." The first few terms are 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, ... (OEIS A005132), illustrated above.

RecamansSequenceBinary

A view of the first 256 terms as binary bits is shown above.

For a positive integer m, let b_m be the first position at which m occurs, or -1 if it never occurs. The sequence b_1, b_2, ... begins 1, 4, 2, 131, 129, 3, 5, ... (OEIS A057167). Its high-water marks are 1, 4, 131, 99734, 181653, 328002, ... (OEIS A064227), attained for m=1, 2, 4, 19, 61, 879, ... (OEIS A064228). These four cited OEIS sequences include an initial 0, omitted here.

Another sequence defined by Recamán starts with a_1=1 and, for n>=2, satisfies (Guy and Nowakowski 1995, Sloane 1999)

 a_n={(a_(n-1))/(n-1)   if (n-1)|a_(n-1); (n-1)a_(n-1)   otherwise.
(2)

The first few terms of this sequence are 1, 1, 2, 6, 24, 120, 20, 140, 1120, ... (OEIS A008336).


See also

High-Water Mark, Integer Sequence

Explore with Wolfram|Alpha

References

Guy, R. K. and Nowakowski, R. J. "Monthly Unsolved Problems, 1969-1995." Amer. Math. Monthly 102, 921-926, 1995. https://doi.org/10.1080/00029890.1995.12004687.Sloane, N. J. A. "My Favorite Integer Sequences." In Sequences and Their Applications (Proceedings of SETA '98) (Ed. C. Ding, T. Helleseth, and H. Niederreiter). London, England: Springer-Verlag, pp. 103-130, 1999. https://doi.org/10.1007/978-1-4471-0551-0_7. https://neilsloane.com/doc/sg.pdf.Sloane, N. J. A. Sequences A005132/M2511, A008336, A057167, A064227, and A064228 in "The On-Line Encyclopedia of Integer Sequences."

Referenced on Wolfram|Alpha

Recamán's Sequence

Cite this as:

Weisstein, Eric W. "Recamán's Sequence." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/RecamansSequence.html

Subject classifications