OFFSET
0,3
LINKS
PROG
(Scheme functions below show the essential idea. For a complete source, see the "Alternative Catalan Orderings" OEIS Wiki page.)
(define (arithrank->lexrank-bijection pr1 pr2) (lambda (n) (CatalanRankGlobal (parenthesization->binexp (unrank-bintree n pr1 pr2)))))
(define (unrank-bintree rank pr1 pr2) (cond ((zero? rank) (list)) (else (cons (unrank-bintree (pr1 (-1+ rank)) pr1 pr2) (unrank-bintree (pr2 (-1+ rank)) pr1 pr2)))))
(define (A002262 n) (- n (binomial_n_2 (floor->exact (+ (/ 1 2) (sqrt (* 2 (1+ n))))))))
(define (A025581 n) (- (binomial_n_2 (1+ (floor->exact (+ (/ 1 2) (sqrt (* 2 (1+ n))))))) (1+ n)))
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Antti Karttunen, May 30 2002
STATUS
approved