login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons 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

A. Karttunen, Table of n, a(n) for n = 0..2055

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 A141661 A278521

Adjacent sequences:  A153236 A153237 A153238 * A153240 A153241 A153242

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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 13 19:30 EDT 2020. Contains 336451 sequences. (Running on oeis4.)