OFFSET
0,3
COMMENTS
This "Catalan bijection" effects the following transformation on the binary trees (labels A,B,C,D refer to arbitrary subtrees located on those nodes and () stands for a terminal node.)
.A..B.C..D.....B..A.D..C.......B...C.......C...B.......A...B........B...A...
..\./.\./.......\./.\./.........\./.........\./.........\./..........\./....
...x...x....-->..x...x.......()..x..-->..()..x...........x..()...-->..x..().
....\./...........\./.........\./.........\./.............\./..........\./..
.....x.............x...........x...........x...............x............x...
i.e. we apply A069770 (that is, the corresponding automorphism) both to the left and right subtree of a binary tree and fix both the empty tree and the tree of one internal node.
LINKS
EXAMPLE
To obtain this signature permutation, we apply these transformations to the binary trees as encoded and ordered by A014486 and for each n, a(n) will be the position of the tree to which the n-th tree transforms to, as follows:
...................one tree of one internal........2 trees of 2 internal nodes
..empty tree.........(non-leaf) node.................................
........................................................\/.......\/..
......x......................\/........................\/.........\/.
n=....0......................1..........................2..........3.
a(n)=.0......................1..........................2..........3.(all these trees are fixed by this transformation)
however, the next 5 trees, with 3 internal nodes, in range [A014137[2], A014138[2]] = [4,8] change as follows:
........\/.....\/.................\/.....\/...
.......\/.......\/.....\/.\/.....\/.......\/..
......\/.......\/.......\_/.......\/.......\/.
n=.....4........5........6........7........8..
....................|.........................
....................|.........................
....................V.........................
......\/.........\/.............\/.........\/.
.......\/.......\/.....\/.\/.....\/.......\/..
......\/.......\/.......\_/.......\/.......\/.
a(n)=..5........4........6........8........7..
thus we obtain the first nine terms of this sequence: 0,1,2,3,5,4,6,8,7,...
PROG
(Scheme functions implementing this automorphism on list-structures:)
(define (gma089864! s) (cond ((pair? s) (if (pair? (car s)) (swap! (car s))) (if (pair? (cdr s)) (swap! (cdr s))))) s)
(define (swap! s) (let ((ex-car (car s))) (set-car! s (cdr s)) (set-cdr! s ex-car) s))
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Nov 29 2003
STATUS
approved