|
|
A370885
|
|
Irregular triangle read by rows: T(n,k) is the total number of unmatched parentheses (both left and right) in the k-th string of parentheses of length n, where strings within a row are in reverse lexicographical order.
|
|
4
|
|
|
0, 1, 1, 2, 2, 0, 2, 3, 3, 1, 3, 1, 1, 1, 3, 4, 4, 2, 4, 2, 2, 2, 4, 2, 2, 0, 2, 0, 2, 2, 4, 5, 5, 3, 5, 3, 3, 3, 5, 3, 3, 1, 3, 1, 3, 3, 5, 3, 3, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 3, 3, 5, 6, 6, 4, 6, 4, 4, 4, 6, 4, 4, 2, 4, 2, 4, 4, 6, 4, 4, 2, 4, 2, 2, 2, 4, 2
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
COMMENTS
|
|
|
REFERENCES
|
Donald E. Knuth, The Art of Computer Programming, Vol. 4A: Combinatorial Algorithms, Part 1, Addison-Wesley, 2011, Section 7.2.1.6, p. 459.
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
Triangle begins:
[0] 0;
[1] 1 1;
[2] 2 2 0 2;
[3] 3 3 1 3 1 1 1 3;
[4] 4 4 2 4 2 2 2 4 2 2 0 2 0 2 2 4;
...
|
|
MATHEMATICA
|
countLR[s_] := StringLength[s] - StringLength[StringJoin[StringCases[s, RegularExpression["1(?R)*+0"]]]];
Array[Map[countLR, IntegerString[Range[0, 2^#-1], 2, #]] &, 7, 0]
|
|
CROSSREFS
|
Apparently, row sums are given by 2*A189391.
|
|
KEYWORD
|
nonn,tabf
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|