login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A066200 a(1) = 1; for n > 1, a(n) = a(n-1)-(n+2) if this is positive and has not already appeared, otherwise a(n) = a(n-1)+(n+2). 2
1, 5, 10, 4, 11, 3, 12, 2, 13, 25, 38, 24, 9, 25, 8, 26, 7, 27, 6, 28, 51, 75, 50, 76, 49, 21, 50, 20, 51, 19, 52, 18, 53, 17, 54, 16, 55, 15, 56, 14, 57, 101, 146, 100, 147, 99, 148, 98, 47, 99, 46, 100, 45, 101, 44, 102, 43, 103, 42, 104, 41, 105, 40, 106, 39, 107, 176 (list; graph; refs; listen; history; text; internal format)
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
A variant of A005132. A row of the array in A066201.
Sequence in context: A084341 A054513 A295121 * A357913 A053822 A262922
KEYWORD
nonn,easy,look
AUTHOR
N. J. A. Sloane, Dec 16 2001
EXTENSIONS
More terms from Vladeta Jovovic, Dec 16 2001
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 10:11 EDT 2024. Contains 371935 sequences. (Running on oeis4.)