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 A091068 #13 Jun 14 2023 19:00:04 %S A091068 0,0,1,3,6,1,6,12,4,12,2,12,0,12,25,10,25,8,25,6,25,4,25,2,25,0,25,51, %T A091068 23,51,21,51,19,51,17,51,15,51,13,51,11,51,9,51,7,51,5,51,3,51,1,51, %U A091068 102,49,102,47,102,45,102,43,102,41,102,39,102,37,102,35,102,33 %N A091068 a(0) = 0; for n>0, a(n) = a(n-1) - n if that is >= 0, else a(n) = a(n-1) + n - 1. %C A091068 A sequence equivalent to A091023. Let b(k) = A091023(k) for all k. Suppose we have just assigned b(x) = n. Then a(n-1) is the number of b(k) for 1 <= k < x that are not yet assigned. %H A091068 Indranil Ghosh, <a href="/A091068/b091068.txt">Table of n, a(n) for n = 0..10000</a> %F A091068 This is a concatenation of blocks: b(-2) = [0], b(-1) = [0], b(0) = [1], b(1) = [3], b(2) = [6 1 6], b(3) = [12 4 12 2 12 0 12], b(4) = [25 10 25 8 25 6 25 4 25 2 25 0 25], ... %F A091068 Let M(k) be the k-th term of A077854. Then block b(k) for k >= 2 is [M(k), x, M(k), x-2, M(k), x-4, M(k), ..., M(k), 0 or 1, M(k)] where x = M(k-1) - 2. The length of the block is M(k+1) - 2 M(k) + M(k-1) (the second difference of A077854, shifted one place). %e A091068 a(4) = 6, 6-5 = 1 >= 0, so a(5) = 1. 1-6 < 0, so a(6) = 1 + 5 = 6. %e A091068 When in A091023 we assign b(8) = 11, there are 2 unassigned b's to the left, namely b(3) and b(6) and indeed a(10) = 2. %t A091068 t={0};Do[AppendTo[t,If[t[[-1]]-n>=0,t[[-1]]-n,t[[-1]]+n-1]],{n,1,69}];t (* _Indranil Ghosh_, Feb 22 2017 *) %t A091068 nxt[{n_,a_}]:={n+1,If[a-n-1>=0,a-n-1,a+n]}; NestList[nxt,{0,0},70][[;;,2]] (* _Harvey P. Dale_, Jun 14 2023 *) %o A091068 (Python) %o A091068 print("0 0") %o A091068 i=1 %o A091068 a=0 %o A091068 if a-i>=0:b=a-i %o A091068 else:b=a+i-1 %o A091068 while i<=100: %o A091068 print(str(i)+" "+str(b)) %o A091068 a=b %o A091068 i+=1 %o A091068 if a-i>=0:b=a-i %o A091068 else:b=a+i-1 # _Indranil Ghosh_, Feb 22 2017 %Y A091068 Cf. A091023, A008344. %K A091068 nonn %O A091068 0,4 %A A091068 _N. J. A. Sloane_, Feb 23 2004