OFFSET
1,1
COMMENTS
There is a simple bijection between the elements of row n and the rooted trees with n nodes. Each matching pair (1,0) in the binary string representation encodes a node, each totally balanced substring encodes a list of subtrees.
LINKS
Alois P. Heinz, Rows n = 1..12, flattened
FORMULA
T(n,k) = A216649(n-1,k)*2 + 2^(2*n-1) for n>1.
EXAMPLE
856 is element of row 5, the binary string representation (with totally balanced substrings enclosed in parentheses) is (1(10)(10)(1(10)0)0). The encoded rooted tree is:
. o
. /|\
. o o o
. |
. o
Triangle T(n,k) begins:
2;
12;
52, 56;
212, 216, 232, 240;
852, 856, 872, 880, 920, 936, 944, 976, 992;
3412, 3416, 3432, 3440, 3480, 3496, 3504, 3536, 3552, 3688, 3696, ...
Triangle T(n,k) in binary:
10;
1100;
110100, 111000;
11010100, 11011000, 11101000, 11110000;
1101010100, 1101011000, 1101101000, 1101110000, 1110011000, ...
110101010100, 110101011000, 110101101000, 110101110000, 110110011000, ...
MAPLE
F:= proc(n) option remember; `if`(n=1, [10], sort(map(h->
parse(cat(1, sort(h)[], 0)), g(n-1, n-1)))) end:
g:= proc(n, i) option remember; `if`(i=1, [[10$n]], [seq(seq(seq(
[seq (F(i)[w[t]-t+1], t=1..j), v[]], w=combinat[choose](
[$1..nops(F(i))+j-1], j)), v=g(n-i*j, i-1)), j=0..n/i)])
end:
b:= proc(n) local h, i, r; h, r:= n, 0; for i from 0
while h>0 do r:= r+2^i*irem(h, 10, 'h') od; r
end:
T:= proc(n) option remember; map(b, F(n))[] end:
seq(T(n), n=1..7);
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Alois P. Heinz, Sep 12 2012
STATUS
approved