%I #20 May 09 2021 05:02:55
%S 2,1,3,6,10,5,11,4,12,21,31,20,8,21,7,22,38,55,37,18,38,17,39,16,40,
%T 15,41,14,42,13,43,74,106,73,107,72,36,73,35,74,34,75,33,76,32,77,123,
%U 170,122,171,121,70,122,69,123,68,124,67,9,68,128,189,127,64,128,63,129,62
%N a(1) = 2; a(2) = 1; for n > 2, a(n) = a(n-1)-(n-1) if this is positive and has not already appeared in the sequence, otherwise a(n) = a(n-1)+(n-1).
%H Indranil Ghosh, <a href="/A066203/b066203.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a>
%o (Python)
%o l=[0, 2, 1]
%o for n in range(3, 101):
%o x=l[n - 1] - (n - 1)
%o if x>0 and x not in l: l.append(x)
%o else: l.append(l[n - 1] + (n - 1))
%o print(l[1:]) # _Indranil Ghosh_, Jun 02 2017
%Y A variant of A005132. A row of the array in A066202.
%K nonn,easy
%O 1,1
%A _N. J. A. Sloane_, Dec 16 2001
%E More terms from _Sascha Kurz_, Mar 24 2002