cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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).

This page as a plain text file.
%I A066200 #24 May 09 2021 05:03:23
%S A066200 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,
%T A066200 50,20,51,19,52,18,53,17,54,16,55,15,56,14,57,101,146,100,147,99,148,
%U A066200 98,47,99,46,100,45,101,44,102,43,103,42,104,41,105,40,106,39,107,176
%N 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).
%H A066200 Robert Israel, <a href="/A066200/b066200.txt">Table of n, a(n) for n = 1..10000</a>
%H A066200 <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a>
%p A066200 S:= {1}:
%p A066200 a[1]:= 1:
%p A066200 for n from 2 to 100 do
%p A066200   t:=a[n-1]-(n+2);
%p A066200   if t > 0 and not member(t,S) then
%p A066200     a[n]:= t
%p A066200   else
%p A066200     a[n]:= a[n-1]+(n+2)
%p A066200   fi;
%p A066200   S:= S union {a[n]}
%p A066200 od:
%p A066200 seq(a[n],n=1..100); # _Robert Israel_, Feb 10 2017
%o A066200 (Python)
%o A066200 l=[0, 1]
%o A066200 for n in range(2, 101):
%o A066200     x=l[n - 1] - (n + 2)
%o A066200     if x>0 and x not in l: l.append(x)
%o A066200     else: l.append(l[n - 1] + (n + 2))
%o A066200 print(l[1:]) # _Indranil Ghosh_, Jun 02 2017
%Y A066200 A variant of A005132. A row of the array in A066201.
%K A066200 nonn,easy,look
%O A066200 1,2
%A A066200 _N. J. A. Sloane_, Dec 16 2001
%E A066200 More terms from _Vladeta Jovovic_, Dec 16 2001