login
This site is supported by donations 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

Robert Israel, Table of n, a(n) for n = 1..10000

Index entries for sequences related to Recamán's sequence

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 xrange(2, 101):

    x=l[n - 1] - (n + 2)

    if x>0 and not x in l: l+=[x, ]

    else: l+=[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 * A053822 A262922 A276652

Adjacent sequences:  A066197 A066198 A066199 * A066201 A066202 A066203

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 | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 16 00:11 EST 2018. Contains 317252 sequences. (Running on oeis4.)