OFFSET
0,3
COMMENTS
In A057501 and A057502, the cycles between (A014138(n-1)+1)-th and (A014138(n))-th term partition A000108(n) objects encoded by the corresponding terms of A014486 into A002995(n+1) equivalence classes of planar trees, thus the latter sequence can be produced also with Maple procedure RotHandshakesPermutationCycleCounts given below.
LINKS
A. Karttunen, Gatomorphisms (Includes the complete Scheme program for computing this sequence)
MAPLE
map(CatalanRankGlobal, map(RotateHandshakesR, A014486));
RotateHandshakesR := n -> pars2binexp(deepreverse(RotateHandshakesP(deepreverse(binexp2pars(n)))));
deepreverse := proc(a) if 0 = nops(a) or list <> whattype(a) then (a) else [op(deepreverse(cdr(a))), deepreverse(a[1])]; fi; end;
with(group); CountCycles := b -> (nops(convert(b, 'disjcyc')) + (nops(b)-convert(map(nops, convert(b, 'disjcyc')), `+`)));
RotHandshakesPermutationCycleCounts := proc(upto_n) local u, n, a, r, b; a := []; for n from 0 to upto_n do b := []; u := (binomial(2*n, n)/(n+1)); for r from 0 to u-1 do b := [op(b), 1+CatalanRank(n, RotateHandshakes(CatalanUnrank(n, r)))]; od; a := [op(a), CountCycles(b)]; od; RETURN(a); end;
# For other procedures, follow A057501.
PROG
(Scheme function implementing this automorphism on list-structures:) (define (RotateHandshakesInv! s) (cond ((not (pair? s))) ((not (pair? (cdr s))) (swap! s)) (else (RotateHandshakesInv! (cdr s)) (robl! 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, Sep 03 2000
STATUS
approved