OFFSET
0,3
COMMENTS
This automorphism 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.)
...B...C...........C...A
....\./.............\./
.A...x....-->....B...x.................A..().........A...()..
..\./.............\./...................\./....-->....\./...
...x...............x.....................x.............x....
(a . (b . c)) -> (b . (c . a)) ______ (a . ()) ---> (a . ())
In terms of S-expressions, this rotates car, cadr and cddr of an S-exp
if its length > 1, otherwise keeps it intact.
Note that the first clause corresponds to generator C of Thompson's groups T and V.
See "Catalan Automorphisms" OEIS-Wiki page for a detailed explanation how to obtain a given integer sequence from this definition.
LINKS
PROG
(Scheme functions implementing this automorphism on list-structures, both constructive (*A089851) and destructive (*A089851!) versions:)
(define (*A089851 s) (if (and (pair? s) (pair? (cdr s))) (cons (cadr s) (cons (cddr s) (car s))) s))
(define (*A089851! s) (cond ((not (pair? s)) s) ((not (pair? (cdr s))) s) (else (swap! s) (robr! s) s)))
(define (swap! s) (let ((ex-car (car s))) (set-car! s (cdr s)) (set-cdr! s ex-car) s))
(define (robr! s) (let ((ex-cdr (cdr s))) (set-cdr! s (caar s)) (set-car! (car s) ex-cdr) (swap! (car s)) (swap! s) s))
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Nov 29 2003
EXTENSIONS
The new mail-address, further comments and constructive implementation of Scheme-function (*A089851) added by Antti Karttunen, Jun 04 2011
STATUS
approved