OFFSET
0,2
COMMENTS
This is the odd-numbers version of Recamán's sequence A005132: a(0)=1; for n>0, a(n) = a(n-1)-(2n+1) if that number is >= 0 and not already in the sequence, otherwise a(n) = a(n-1)+(2n+1).
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
MATHEMATICA
f[s_List]:= Block[{a = s[[-1]], len = Length@s}, Append[s, If[a > len && ! MemberQ[s, a - len], a - len, a + len]]]; A005132:= Nest[f, {0}, 130]; Table[2*A005132[[n]] + 1, {n, 1, 50}] (* G. C. Greubel, Jan 03 2018 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Mar 07 2012
STATUS
approved