cp's OEIS Frontend

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.

Showing 1-1 of 1 results.

A330155 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.

Original entry on oeis.org

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, 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, 5, 3, 2, 12, 11, 9, 8, 4, 1, 7, 10, 7, 5, 4, 2, 1, 12, 11, 9, 8, 3, 13, 6, 10
Offset: 1

Views

Author

Keywords

Examples

			Triangle begins:
  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,  7,  2;
  5,  3,  2,  9,  8,  6,  4,  7,  1;
  5,  4,  2,  1,  9,  8,  6,  3,  7, 10;
  ...
With n=5, row #5 is 3,1,5,2,4. In the diagram below, each "X" represents the removal of a card:
.
                          +-->4X
                          |
                   +-->2X |
                   |      |
            +-->4--+-->4--+
            |      |
     +-->5--+-->5X |
     |      |      |
  1--+-->1X |      |
     |      |      |
  2--+-->2--+-->2--+
     |      |
  3X |      |
     |      |
  4--+-->4--+
     |
  5--+
		

Crossrefs

This triangle is based on A308432.

Formula

T(n,n) = A308432(n), n > 0.
Conjecture: (Start)
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).
Let z = ceiling(m/2); the first z elements in S(m) are z,z-1,z-2,...,1.
Let G(x) = 3*((x-2)/2)+2 if x even,
3*((x-1)/2)+1 otherwise.
Let B(x) = Sum_{i=0..x-1} 2*G(m)*3^i.
Let C(x) = z if x=0,
B(x)+z otherwise.
C(x)-th element in S(m) is 1, for all x >= 0.
Let D(x) = G(m)*3^(x-1), with x > 0.
Let y = minimum x such that k <= C(x).
Finally S(m) = z-k+1 if z >= k,
D(y)+1 if C(y)-k >= D(y),
C(y)-k+1 otherwise.
for all k.
Then T(n,k) = k-th element in S(n-k+1).
(End)
Showing 1-1 of 1 results.