

A281552


Write n in the Elias gamma 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.


1



0, 1, 1, 2, 2, 6, 2, 3, 3, 9, 3, 8, 8, 9, 3, 4, 4, 12, 4, 11, 11, 12, 4, 10, 10, 18, 10, 11, 11, 12, 4, 5, 5, 15, 5, 14, 14, 15, 5, 13, 13, 23, 13, 14, 14, 15, 5, 12, 12, 22, 12, 21, 21, 22, 12, 13, 13, 23, 13, 14, 14, 15, 5, 6, 6, 18, 6, 17, 17, 18, 6, 16, 16, 28, 16, 17, 17, 18, 6
(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(A171885(n)) for n > = 1.


EXAMPLE

For n = 6 , the Elias gamma code for n is '11010'. In '11010', the positions of '1' followed immediately to the right by '0' counting from left are 2 and 4. So, a(6) = 2 + 4 = 6.
For n = 10, the Elias gamma code for n is '1110010'. In '1110010', the positions of '1' followed immediately to the right by '0' counting from left are 3 and 6. So, a(10) = 3 + 6 = 9.


PROG

(Python)
def a(n):
....x= A281149(n)
....s=0
....for i in range(1, len(x)):
........if x[i1]=="1" and x[i]=="0":
............s+=i
....return s


CROSSREFS

Cf. A049501, A171885, A281149, A281388, A281497.
Sequence in context: A278250 A134339 A162299 * A205506 A110141 A293443
Adjacent sequences: A281549 A281550 A281551 * A281553 A281554 A281555


KEYWORD

nonn,base


AUTHOR

Indranil Ghosh, Jan 24 2017


STATUS

approved



