A381127 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-SpellUnder dealing is used, then the resulting cards will be dealt in increasing order.
1, 1, 2, 1, 3, 2, 1, 2, 4, 3, 1, 3, 5, 4, 2, 1, 6, 4, 3, 2, 5, 1, 5, 3, 6, 2, 4, 7, 1, 3, 4, 5, 2, 7, 6, 8, 1, 6, 7, 9, 2, 8, 5, 4, 3, 1, 7, 6, 5, 2, 10, 4, 9, 3, 8, 1, 5, 10, 11, 2, 4, 7, 9, 3, 6, 8, 1, 7, 8, 4, 2, 12, 6, 9, 3, 11, 5, 10, 1, 11, 4, 6, 2, 12, 13, 8, 3, 5, 7, 9, 10, 1, 4, 9, 8, 2, 12, 7, 5, 3, 13, 14, 11, 10, 6
Offset: 1
Examples
Triangle begins: 1; 1, 2; 1, 3, 2; 1, 2, 4, 3; 1, 3, 5, 4, 2; 1, 6, 4, 3, 2, 5; 1, 5, 3, 6, 2, 4, 7; 1, 3, 4, 5, 2, 7, 6, 8; ... For n = 4, suppose there are four cards arranged in the order 1,2,4,3. Card 1 is dealt, and then three cards go under the deck because O-N-E has three letters. Now, the deck is ordered 2,4,3. Card 2 is dealt, and three cards go under because T-W-O has three letters. Now, the leftover deck is ordered 3,4. Card 3 is dealt, and five cards go under because T-H-R-E-E has five letters. Then card 4 is dealt. The dealt cards are in numerical order. Thus, the fourth row of the triangle is 1, 2, 4, 3.
Crossrefs
Programs
-
Python
from num2words import num2words as n2w def f(n): return sum(1 for c in n2w(n).replace(" and", "") if c.isalpha()) def row(n): c, i, J, out = 1, 0, list(range(1, n+1)), [] while len(J) > 1: q = J.pop(i) out.append(q) i = (i + f(c))%len(J) c = c+1 out.append(J[0]) return [out.index(j)+1 for j in list(range(1, n+1))] print([e for n in range(1, 15) for e in row(n)]) # Michael S. Branicky, Feb 16 2025
Comments