%I #27 Jun 18 2019 05:59:29
%S 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 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 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 Lexicographically earliest version of a self referencing "Kimberling shuffle" expulsion array sequence.
%C 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 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 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 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 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 (PARI)
%o 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 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 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 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 setgroup(v, n, group) = {my(gmin = vecmin(group)); for (i=1, #group, if ((group[i] <= #v) && !v[n], v[n] = gmin);); v;}
%o 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 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 earliest(lista()) \\ _Michel Marcus_, Jun 14 2019
%Y Cf. A007063, A307536, A006852, A000027.
%K nonn
%O 1,2
%A _David James Sycamore_ and _Lars Blomberg_, Apr 29 2019