OFFSET
0,13
COMMENTS
LINKS
A. Karttunen, Table of n, a(n) for n = 0..2055
EXAMPLE
A014486(25) encodes the following general tree:
......o
......|
o.o...o.o
.\.\././
....*..
which consists of four subtrees, of which the second from right is one larger than the others, so we have a(25) = (0+1)-(0+0) = 1.
PROG
(MIT Scheme:)
(define (gentree-deep-balance l) (let ((r (reverse l))) (let loop ((i 0) (j (- (length l) 1)) (l l) (r r) (z 0)) (cond ((= i j) (+ z (gentree-deep-balance (car l)))) ((> i j) z) (else (loop (+ i 1) (- j 1) (cdr l) (cdr r) (+ z (- (count-pars (car r)) (count-pars (car l))))))))))
(define (count-pars a) (cond ((not (pair? a)) 0) (else (+ 1 (count-pars (car a)) (count-pars (cdr a))))))
CROSSREFS
KEYWORD
sign
AUTHOR
Antti Karttunen, Dec 21 2008
STATUS
approved