OFFSET
0,3
COMMENTS
This bijection effects the following transformation on the unlabeled rooted plane binary trees (letters A, B, C refer to arbitrary subtrees located on those nodes and () stands for an implied terminal node).
A B A C
\ / \ /
x C --> x B () A () A
\ / \ / \ / --> \ /
x x x x
((a . b) . c) --> ((a . c) . b) (() . a) ---> (() . a)
See the example for an explanation of how to obtain a given integer sequence from this definition.
Notably for this permutation, A127301(a(n)) = A127301(n) does not always hold, even though for all n, A129593(a(n)) = A129593(n). - Antti Karttunen, Jan 14 2024
LINKS
EXAMPLE
To obtain the 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 is transformed to, as follows:
.
one tree of one internal
empty tree (non-leaf) node
x \/
n= 0 1
a(n)= 0 1 (both are always fixed)
.
.
\/ \/ \/ \/
\/ \/ \/ \/ \/ \/ \/ \/
\/ \/ \/ \/ \_/ \/ \/
n= 2 3 4 5 6 7 8
.
and the new shapes after swapping the two subtrees in positions marked "B" and "C" in the diagram given in the comments are:
.
\/ \/ \/ \/
\/ \/ \/ \/ \/ \/ \/ \/
\/ \/ \/ \/ \/ \_/ \/
a(n)= 2 3 4 5 7 6 8
thus we obtain the first nine terms of this sequence: 0, 1, 2, 3, 4, 5, 7, 6, 8.
PROG
(Scheme function implementing this automorphism on list-structures/S-expressions, both constructive (*A072797) and destructive (*A072797!) version:)
(define (*A072797 s) (if (and (pair? s) (pair? (car s))) (cons (cons (caar s) (cdr s)) (cdar s)) s))
(define (*A072797! s) (cond ((not (pair? s)) s) ((not (pair? (car s))) s) (else (swap! s) (robl! s) (swap! (car s)) s)))
(define (robl! s) (let ((ex-car (car s))) (set-car! s (cddr s)) (set-cdr! (cdr s) ex-car) (swap! (cdr s)) (swap! 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, Jun 12 2002
EXTENSIONS
Further comments added by Antti Karttunen, Jun 04 2011 and Mar 30 2024
STATUS
approved