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.

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

This page as a plain text file.
%I A066203 #20 May 09 2021 05:02:55
%S A066203 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 A066203 15,41,14,42,13,43,74,106,73,107,72,36,73,35,74,34,75,33,76,32,77,123,
%U A066203 170,122,171,121,70,122,69,123,68,124,67,9,68,128,189,127,64,128,63,129,62
%N A066203 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 A066203 Indranil Ghosh, <a href="/A066203/b066203.txt">Table of n, a(n) for n = 1..10000</a>
%H A066203 <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a>
%o A066203 (Python)
%o A066203 l=[0, 2, 1]
%o A066203 for n in range(3, 101):
%o A066203     x=l[n - 1] - (n - 1)
%o A066203     if x>0 and x not in l: l.append(x)
%o A066203     else: l.append(l[n - 1] + (n - 1))
%o A066203 print(l[1:]) # _Indranil Ghosh_, Jun 02 2017
%Y A066203 A variant of A005132. A row of the array in A066202.
%K A066203 nonn,easy
%O A066203 1,1
%A A066203 _N. J. A. Sloane_, Dec 16 2001
%E A066203 More terms from _Sascha Kurz_, Mar 24 2002