OFFSET
0,5
COMMENTS
For n > 0 and after A005132(n-1) the algorithm of Recamán's sequence first explores if a(n) is a valid number to be its next term. If a(n) is nonnegative and not already in the sequence A005132 then a(n) is accepted, so A005132(n) = a(n), otherwise a(n) is rejected and A005132(n) = A005132(n-1) + n, not a(n).
For an illustration of initial terms see the diagram in A334950.
LINKS
FORMULA
a(0) = 0; for n > 0, a(n) = A005132(n-1) - n.
CROSSREFS
KEYWORD
sign
AUTHOR
Omar E. Pol, May 17 2020
STATUS
approved