A380201 Triangle T(n,k) read by rows, where row n is a permutation of numbers 1 through n, such that if a deck of n cards is prepared in this order, and SpellUnder-Down dealing is used, then the resulting cards are put down in increasing order.
1, 2, 1, 1, 3, 2, 2, 4, 3, 1, 5, 3, 2, 1, 4, 4, 2, 5, 1, 3, 6, 2, 3, 4, 1, 6, 5, 7, 5, 6, 8, 1, 7, 4, 3, 2, 6, 5, 4, 1, 9, 3, 8, 2, 7, 4, 9, 10, 1, 3, 6, 8, 2, 5, 7, 6, 7, 3, 1, 11, 5, 8, 2, 10, 4, 9, 10, 3, 5, 1, 11, 12, 7, 2, 4, 6, 8, 9, 3, 8, 7, 1, 11, 6, 4, 2, 12, 13, 10, 9, 5, 12, 10, 6, 1, 13, 4, 9, 2, 14, 8, 11, 5
Offset: 1
Examples
Triangle begins: 1; 2, 1; 1, 3, 2; 2, 4, 3, 1; 5, 3, 2, 1, 4; 4, 2, 5, 1, 3, 6; 2, 3, 4, 1, 6, 5, 7; 5, 6, 8, 1, 7, 4, 3, 2; ... For n = 4 suppose there are four cards arranged in order 2, 4, 3, 1. Three cards go under for each letter in O-N-E, then 1 is dealt. Now the deck is ordered 2,4,3. Three cards go under for each letter in T-W-O, then card 2 is dealt. Now the leftover deck is ordered 4,3. Five cards go under for each letter in T-H-R-E-E, then card 3 is dealt. Finally, card 4 is dealt. The dealt cards are in numerical order. Thus, the fourth row of the triangle is 2, 4, 3, 1.
Crossrefs
Programs
-
Python
from num2words import num2words as n2w def spell(n): return sum(1 for c in n2w(n).replace(" and", "").replace(" ", "").replace(",","").replace("-", "")) def nthRow(n): l = [] for i in range(0,n): l.append(0) zp = 0 for j in range(1,n+1): zc = 0 while zc <= spell(j): if l[zp] == 0: zc += 1 zp += 1 zp = zp % n l[zp-1] = str(j) return l l = [] for i in range(1,20): l += nthRow(i) print(", ".join(l))
Comments