login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A281388 Write n in binary reflected Gray code and sum the positions where there is a '1' followed immediately to the right by a '0', counting the leftmost digit as position 1. 3
0, 0, 1, 2, 0, 1, 1, 2, 2, 0, 3, 4, 1, 1, 1, 2, 2, 2, 6, 4, 0, 3, 3, 4, 4, 1, 5, 5, 1, 1, 1, 2, 2, 2, 7, 7, 2, 6, 6, 4, 4, 0, 5, 8, 3, 3, 3, 4, 4, 4, 9, 6, 1, 5, 5, 5, 5, 1, 6, 6, 1, 1, 1, 2, 2, 2, 8, 8, 2, 7, 7, 7, 7, 2, 8, 12, 6, 6, 6, 4, 4, 4, 10, 6, 0, 5, 5, 8, 8, 3, 9, 9, 3, 3, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,4

LINKS

Indranil Ghosh, Table of n, a(n) for n = 1..10000

FORMULA

a(n) = A049501(A003188(n)).

EXAMPLE

For n = 11, the binary reflected Gray code for 11 is '1110'. In '1110', the position of '1' followed immediately to the right by '0' counting from left is 3. So, a(11) = 3.

For n = 12, the binary reflected Gray code for 12 is '1010'. In '1010', the positions of '1' followed immediately to the right by '0' counting from left are 1 and 3. So, a(12) = 1 + 3 = 4.

PROG

(Python)

def g(n):

....return bin(n^(n/2))[2:]

def a(n):

....x=g(n)

....s=0

....for i in range(1, len(x)):

........if x[i-1]=="1" and x[i]=="0":

............s+=i

....return s

CROSSREFS

Cf. A003188, A014550, A049501.

Sequence in context: A236532 A077763 A030218 * A127440 A118198 A290885

Adjacent sequences:  A281385 A281386 A281387 * A281389 A281390 A281391

KEYWORD

nonn,base

AUTHOR

Indranil Ghosh, Jan 21 2017

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 21 03:01 EST 2018. Contains 317427 sequences. (Running on oeis4.)