A383847 Triangle T(n,k) read by rows, where row n is a permutation of the numbers 1 through n, such that if a deck of n cards is prepared in this order, and down-down-under dealing is used, then the resulting cards will be dealt in increasing order.
1, 1, 2, 1, 2, 3, 1, 2, 4, 3, 1, 2, 5, 3, 4, 1, 2, 5, 3, 4, 6, 1, 2, 6, 3, 4, 7, 5, 1, 2, 8, 3, 4, 7, 5, 6, 1, 2, 7, 3, 4, 8, 5, 6, 9, 1, 2, 8, 3, 4, 10, 5, 6, 9, 7, 1, 2, 11, 3, 4, 9, 5, 6, 10, 7, 8, 1, 2, 9, 3, 4, 10, 5, 6, 12, 7, 8, 11, 1, 2, 10, 3, 4, 13, 5, 6, 11, 7, 8, 12, 9
Offset: 1
Examples
Consider a deck of four cards arranged in the order 1,2,4,3. In round 1, card 1 is dealt, card 2 is dealt, and card 4 goes under. Now the deck is ordered 3,4. In round 2, card 3 is dealt, then card 4 is dealt. The dealt cards are in order. Thus, the fourth row of the triangle is 1,2,4,3. The table begins: 1; 1, 2; 1, 2, 3; 1, 2, 4, 3; 1, 2, 5, 3, 4; 1, 2, 5, 3, 4, 6; 1, 2, 6, 3, 4, 7, 5; 1, 2, 8, 3, 4, 7, 5, 6;
Programs
-
Python
def row(n): i, J, out = 0, list(range(1, n+1)), [] while len(J) > 1: out.append(J.pop(i)) i = i%len(J) if len(J) > 1: out.append(J.pop(i)) i = (i + 1)%len(J) out += [J[0]] return [out.index(j)+1 for j in list(range(1, n+1))] print([e for n in range(1, 14) for e in row(n)])
Formula
T(n,3j+1) = 2j+1, for 3j+1 <= n. T(n,3j+2) = 2j+2, for 3j+2 <= n.
Comments