login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A153239 Balance of binary trees as ordered by A014486: number of vertices in the right subtree minus number of vertices in the left subtree. 5
0, 0, 1, -1, 2, 2, 0, -2, -2, 3, 3, 3, 3, 3, 1, 1, -1, -3, -3, -1, -3, -3, -3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 0, -2, -4, -4, -2, -4, -4, -4, 0, 0, -2, -4, -4, -2, -4, -4, -4, -2, -4, -4, -4, -4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,5
COMMENTS
Note that for all n, Sum_{i=A014137(n)}^A014138(n) a(i) = 0.
LINKS
EXAMPLE
A014486(19) encodes the following binary tree:
.\/
..\/.\/
...\./
Because the subtree at the right contains just one internal node and the subtree at the left contains two, we have a(19) = 1-2 = -1.
PROG
(MIT Scheme:)
(define (A153239 n) (let ((s (A014486->parenthesization (A014486 n)))) (if (null? s) 0 (- (count-pars (cdr s)) (count-pars (car s))))))
(define (count-pars a) (cond ((not (pair? a)) 0) (else (+ 1 (count-pars (car a)) (count-pars (cdr a))))))
CROSSREFS
A153243 gives the positions of zeros. Cf. A153240, A153241.
Sequence in context: A217943 A177225 A236306 * A229502 A356359 A141661
KEYWORD
sign
AUTHOR
Antti Karttunen, Dec 21 2008
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 12:14 EDT 2024. Contains 371969 sequences. (Running on oeis4.)