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.
%I A064289 #28 Mar 03 2024 09:30:10 %S A064289 0,1,2,3,2,3,4,5,4,5,4,5,4,5,4,5,4,5,6,7,6,7,6,5,6,5,6,5,6,5,6,5,6,7, %T A064289 8,7,8,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,8,9, %U A064289 8,9,8,9,8,9,8,9,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7 %N A064289 Height of n-th term in Recamán's sequence A005132. %C A064289 The height of a term in A005132 = number of addition steps - number of subtraction steps to produce it. %C A064289 Partial sums of A160357. - _Allan C. Wechsler_, Sep 08 2019 %H A064289 Alois P. Heinz, <a href="/A064289/b064289.txt">Table of n, a(n) for n = 0..100000</a> %H A064289 Nick Hobson, <a href="/A064289/a064289.py.txt">Python program for this sequence</a> %H A064289 N. J. A. Sloane, <a href="/A005132/a005132.txt">FORTRAN program for A005132, A057167, A064227, A064228</a> %H A064289 <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a> %e A064289 A005132 begins 1, 3, 6, 2, 7, 13, 20, 12, ... and these terms have heights 1, 2, 3, 2, 3, 4, 5, 4, ... %p A064289 g:= proc(n) is(n=0) end: %p A064289 b:= proc(n) option remember; local t; %p A064289 if n=0 then 0 else t:= b(n-1)-n; if t<=0 or g(t) %p A064289 then t:= b(n-1)+n fi; g(t):= true; t fi %p A064289 end: %p A064289 a:= proc(n) option remember; `if`(n=0, 0, %p A064289 a(n-1)+signum(b(n)-b(n-1))) %p A064289 end: %p A064289 seq(a(n), n=0..120); # _Alois P. Heinz_, Sep 08 2019 %t A064289 g[n_] := n == 0; %t A064289 b[n_] := b[n] = Module[{t}, If[n == 0, 0, t = b[n - 1] - n; If[t <= 0 || g[t], t = b[n - 1] + n]; g[t] = True; t]]; %t A064289 a[n_] := a[n] = If[n == 0, 0, a[n - 1] + Sign[b[n] - b[n - 1]]]; %t A064289 a /@ Range[0, 100] (* _Jean-François Alcover_, Apr 11 2020, after _Alois P. Heinz_ *) %Y A064289 Cf. A005132, A064288, A064290, A064292, A064293, A064294, A160357. %K A064289 nonn,easy %O A064289 0,3 %A A064289 _N. J. A. Sloane_, Sep 25 2001 %E A064289 a(0)=0 prepended by _Allan C. Wechsler_, Sep 08 2019