OFFSET
1,2
LINKS
MAPLE
S:= {1}:
a[1]:= 1:
for n from 2 to 100 do
t:=a[n-1]-(n+2);
if t > 0 and not member(t, S) then
a[n]:= t
else
a[n]:= a[n-1]+(n+2)
fi;
S:= S union {a[n]}
od:
seq(a[n], n=1..100); # Robert Israel, Feb 10 2017
PROG
(Python)
l=[0, 1]
for n in range(2, 101):
x=l[n - 1] - (n + 2)
if x>0 and x not in l: l.append(x)
else: l.append(l[n - 1] + (n + 2))
print(l[1:]) # Indranil Ghosh, Jun 02 2017
CROSSREFS
KEYWORD
AUTHOR
N. J. A. Sloane, Dec 16 2001
EXTENSIONS
More terms from Vladeta Jovovic, Dec 16 2001
STATUS
approved