%I #31 Jan 06 2020 03:46:38
%S 1,1,2,2,3,1,2,1,3,4,3,1,5,2,4,3,2,6,5,1,4,4,2,1,6,5,7,3,4,3,1,8,6,5,
%T 7,2,5,3,2,9,8,6,4,7,1,5,4,2,1,9,8,6,3,7,10,6,4,3,1,11,9,8,5,2,7,10,6,
%U 5,3,2,12,11,9,8,4,1,7,10,7,5,4,2,1,12,11,9,8,3,13,6,10
%N Triangle read by rows. Given n enumerated cards in a stack, with 1 at the top and n at the bottom, repeat the following process k times: remove the card in the middle (at position (size of the stack)/2, rounding up), and move the card at the bottom of the stack to the top. T(n,k) is the number of the last card removed.
%F T(n,n) = A308432(n), n > 0.
%F Conjecture: (Start)
%F Each diagonal forms a unique sequence S. Let S(m) be the m-th diagonal in T, for example with m=2, S(2) = 1,3,3,2,1,7,...; then T(n,k) = k-th element in S(n-k+1).
%F Let z = ceiling(m/2); the first z elements in S(m) are z,z-1,z-2,...,1.
%F Let G(x) = 3*((x-2)/2)+2 if x even,
%F 3*((x-1)/2)+1 otherwise.
%F Let B(x) = Sum_{i=0..x-1} 2*G(m)*3^i.
%F Let C(x) = z if x=0,
%F B(x)+z otherwise.
%F C(x)-th element in S(m) is 1, for all x >= 0.
%F Let D(x) = G(m)*3^(x-1), with x > 0.
%F Let y = minimum x such that k <= C(x).
%F Finally S(m) = z-k+1 if z >= k,
%F D(y)+1 if C(y)-k >= D(y),
%F C(y)-k+1 otherwise.
%F for all k.
%F Then T(n,k) = k-th element in S(n-k+1).
%F (End)
%e Triangle begins:
%e 1;
%e 1, 2;
%e 2, 3, 1;
%e 2, 1, 3, 4;
%e 3, 1, 5, 2, 4;
%e 3, 2, 6, 5, 1, 4;
%e 4, 2, 1, 6, 5, 7, 3;
%e 4, 3, 1, 8, 6, 5, 7, 2;
%e 5, 3, 2, 9, 8, 6, 4, 7, 1;
%e 5, 4, 2, 1, 9, 8, 6, 3, 7, 10;
%e ...
%e With n=5, row #5 is 3,1,5,2,4. In the diagram below, each "X" represents the removal of a card:
%e .
%e +-->4X
%e |
%e +-->2X |
%e | |
%e +-->4--+-->4--+
%e | |
%e +-->5--+-->5X |
%e | | |
%e 1--+-->1X | |
%e | | |
%e 2--+-->2--+-->2--+
%e | |
%e 3X | |
%e | |
%e 4--+-->4--+
%e |
%e 5--+
%Y This triangle is based on A308432.
%K nonn,tabl
%O 1,3
%A _Wilmer Emiro Castrillon Calderon_, Dec 03 2019