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!)
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
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[i-1]=="1" and x[i]=="0":
............s+=i
....return s
CROSSREFS
Sequence in context: A357441 A134339 A162299 * A205506 A110141 A339489
KEYWORD
nonn,base
AUTHOR
Indranil Ghosh, Jan 24 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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 23 04:43 EDT 2024. Contains 374544 sequences. (Running on oeis4.)