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.

A063733 A variant of Recamán's sequence: a(0)=1, a(n) = a(n-1)-(n-1) if positive and new, else a(n) = a(n-1)+(n-1).

This page as a plain text file.
%I A063733 #29 Mar 09 2021 19:12:44
%S A063733 1,1,2,4,7,3,8,14,21,13,22,12,23,11,24,10,25,9,26,44,63,43,64,42,19,
%T A063733 43,18,44,17,45,16,46,15,47,80,114,79,115,78,40,79,39,80,38,81,37,82,
%U A063733 36,83,35,84,34,85,33,86,32,87,31,88,30,89,29,90,28,91,27
%N A063733 A variant of Recamán's sequence: a(0)=1, a(n) = a(n-1)-(n-1) if positive and new, else a(n) = a(n-1)+(n-1).
%H A063733 Reinhard Zumkeller, <a href="/A063733/b063733.txt">Table of n, a(n) for n = 0..10000</a>
%H A063733 <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a>
%F A063733 a(n+1) = A005132(n) - 1; A005132 is Recamán's sequence. - _Franklin T. Adams-Watters_, Mar 12 2010
%t A063733 a[0] = 1; a[n_] := a[n] = If[an = a[n-1] - (n-1); an > 0 && FreeQ[Array[a, n-1], an], an, a[n-1] + (n-1)]; Table[a[n], {n, 0, 65}] (* _Jean-François Alcover_, Feb 18 2018 *)
%o A063733 (Haskell)
%o A063733 a063733 n = a063733_list !! n
%o A063733 a063733_list = 1 : f 0 [1] where
%o A063733    f x ys@(y:_) | u > 0 && u `notElem` ys = u : f (x + 1) (u : ys)
%o A063733                 | otherwise               = v : f (x + 1) (v : ys)
%o A063733                 where u = y - x; v = x + y
%o A063733 -- _Reinhard Zumkeller_, Jul 02 2015
%o A063733 (Python)
%o A063733 l=[1]
%o A063733 for n in range(1, 101):
%o A063733     x = l[n - 1] - (n - 1)
%o A063733     if x > 0 and x not in l:
%o A063733         l.append(x)
%o A063733     else:
%o A063733         l.append(l[n - 1] + (n - 1))
%o A063733 print(l) # _Indranil Ghosh_, Jun 02 2017
%Y A063733 See A005132, which is the main entry for this sequence. A063753 = 1 + A005132. A row of A066201. Also a row of A066202.
%Y A063733 See also A078943.
%Y A063733 Cf. A141126.
%K A063733 nonn,nice,easy,look
%O A063733 0,3
%A A063733 _N. J. A. Sloane_, Sep 05 2001