A307797 Lexicographically earliest version of a self referencing "Kimberling shuffle" expulsion array sequence.
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, 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, 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
Offset: 1
Keywords
Examples
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. 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.
Links
- D. Gale, Tracking the Automatic Ant: And Other Mathematical Explorations, ch. 5, p. 27. Springer, 1998.
- C. Kimberling, Problem 1615, Crux Mathematicorum, Vol. 17 (2) 44 1991 and Vol. 18, March 1992, pp. 82-83.
Programs
-
PARI
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 B(z) = {a=z; n=1; while (a!=n, if (a
2*n, a--, a=2*(a-n)-1); n++); return(a);} \\ A006852 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;} 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);} setgroup(v, n, group) = {my(gmin = vecmin(group)); for (i=1, #group, if ((group[i] <= #v) && !v[n], v[n] = gmin);); v;} 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 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);} earliest(lista()) \\ Michel Marcus, Jun 14 2019
Comments