Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A125989
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A125989 Sum of heights of 10's in binary expansion of n. +0
2
0, 0, 1, 0, 2, 0, 1, 0, 3, 1, 2, -1, 2, 0, 1, 0, 4, 2, 3, 0, 4, 0, 1, -2, 3, 1, 2, -1, 2, 0, 1, 0, 5, 3, 4, 1, 5, 1, 2, -1, 6, 2, 3, -2, 3, -1, 0, -3, 4, 2, 3, 0, 4, 0, 1, -2, 3, 1, 2, -1, 2, 0, 1, 0, 6, 4, 5, 2, 6, 2, 3, 0, 7, 3, 4, -1, 4, 0, 1, -2, 8, 4, 5, 0, 6, 0, 1, -4, 5, 1, 2, -3, 2, -2, -1 (list; graph; listen)
OFFSET

0,5

COMMENT

The 'height' of the digits in the binary expansion of n is here defined by the algorithm where, starting from the least significant bit and the height=0 and proceeding leftwards, all encountered 1-bits decrease the height by one and all 0-bits increase it by one. The sequence gives the sums of heights at the positions where 0 changes to 1 when scanning the binary expansion from right to left. This sequence is used for computing A126302.

EXAMPLE

E.g. the lattice path /\/\ is encoded by 10 as 1010 in binary and both peaks occur at height=1, thus a(10)=2.

In comparison, 11 is 1011 in binary, so the only peak '10' occurs at height -1:

.../

/\/

thus a(11)=-1.

PROGRAM

(Scheme:) (define (A125989 n) (let loop ((n n) (s 0) (h 0)) (cond ((zero? n) s) ((= 2 (modulo n 4)) (loop (/ (- n 2) 4) (+ s h 1) h)) ((odd? n) (loop (/ (- n 1) 2) s (- h 1))) (else (loop (/ n 2) s (+ 1 h))))))

CROSSREFS

A126302 = a(A014486(n)). Cf. A085198.

Sequence in context: A124305 A087073 A106844 this_sequence A125924 A082513 A086780

Adjacent sequences: A125986 A125987 A125988 this_sequence A125990 A125991 A125992

KEYWORD

sign,base

AUTHOR

Antti Karttunen (His-Firstname.His-Surname(AT)gmail.com), Jan 02 2007

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | The OEIS Foundation | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified March 20 09:10 EDT 2010. Contains 173642 sequences.


AT&T Labs Research