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 A307797 #27 Jun 18 2019 05:59:29 %S A307797 1,2,2,3,2,4,4,5,2,2,6,2,7,8,4,4,2,6,9,2,10,4,2,2,2,11,12,4,6,11,7,6, %T A307797 9,9,6,2,11,11,7,13,11,2,2,7,14,2,11,9,15,16,17,17,10,7,11,2,18,11,4, %U A307797 7,2,12,19,18,11,4,10,11,10,6,11,13,20,21,14,6,22,23,2,24,4,15,2,2,25,20,26,12,27,7,16,28,29,30,11,31,13,29,11 %N A307797 Lexicographically earliest version of a self referencing "Kimberling shuffle" expulsion array sequence. %C A307797 Start with this sequence, "shuffle" as in A007063 and the sequence reappears in the diagonal of the array. Terms are transformed from A307536 to this lexicofirst version by replacing the first and all subsequent occurrences of any term > all preceding terms by k+1, where k is the greatest (transformed) term seen so far. The records of this sequence is the natural numbers, A000027, starting point of the original Kimberling exclusion array. %H A307797 D. Gale, <a href="http://dx.doi.org/10.1007/978-1-4612-2192-0">Tracking the Automatic Ant: And Other Mathematical Explorations</a>, ch. 5, p. 27. Springer, 1998. %H A307797 C. Kimberling, <a href="https://cms.math.ca/crux/backfile/Crux_v18n03_Mar.pdf">Problem 1615</a>, Crux Mathematicorum, Vol. 17 (2) 44 1991 and Vol. 18, March 1992, pp. 82-83. %e A307797 A307536(4)=4 > all preceding terms, the greatest of which is 2, so a(4)=3. Since 4 appears only once in A307536, 3 appears only once in this sequence. %e A307797 A307536(21)=21 > all preceding terms, the greatest of which (in this sequence) is 9, so a(21)=10. Subsequent terms with the same value are a(53), a(67), a(69), ... because the corresponding terms (same indices) in A307536 all have value 21. %o A307797 (PARI) %o A307797 A(z) = {x=z; y=z; xx=2*x-4; while (y<=xx, x--; xx-=2; if (bittest(y, 0)==1, y=x+((y+1)>>1), y=x-(y>>1))); return(x+y-1); } \\ A007063 %o A307797 B(z) = {a=z; n=1; while (a!=n, if (a<n, a=2*(n-a), a>2*n, a--, a=2*(a-n)-1); n++); return(a);} \\ A006852 %o A307797 addgroup(group, n, fixed, v) = {my(ok = 1, m=v[n]); while(ok, listput(group, m); if (m==n, ok=0; break); if (m > #v, ok=0; break); n = m; m = v[n];); group;} %o A307797 makegroup(n, fixed, va, vb) = {my(group = List()); listput(group, n); group = addgroup(group, n, fixed, va); group = addgroup(group, n, fixed, vb); listsort(group, 1); Vec(group);} %o A307797 setgroup(v, n, group) = {my(gmin = vecmin(group)); for (i=1, #group, if ((group[i] <= #v) && !v[n], v[n] = gmin);); v;} %o A307797 lista() = {nn = 200; nout = 90; va = vector(nn, k, A(k)); vb = vector(nn, k, B(k)); vc = vector(nn); fixed = List(); for (n = 1, nn, if (va[n] == n, listput(fixed, n));); fixed = Vec(fixed); for (n=1, nn, group = makegroup(n, fixed, va, vb); vc = setgroup(vc, n, group);); vector(nout, k, vc[k]);} \\ A307536 %o A307797 earliest(v) = {my(m = Map(), val=1); for (i=1, #v, if (!mapisdefined(m, v[i]), mapput(m, v[i], val); val++);); apply(x->mapget(m, x), v);} %o A307797 earliest(lista()) \\ _Michel Marcus_, Jun 14 2019 %Y A307797 Cf. A007063, A307536, A006852, A000027. %K A307797 nonn %O A307797 1,2 %A A307797 _David James Sycamore_ and _Lars Blomberg_, Apr 29 2019