cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A281552 #9 May 22 2025 10:21:45
%S A281552 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,
%T A281552 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,
%U A281552 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
%N 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.
%H A281552 Indranil Ghosh, <a href="/A281552/b281552.txt">Table of n, a(n) for n = 1..10000</a>
%F A281552 a(n) = A049501(A171885(n)) for n > = 1.
%e A281552 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.
%e A281552 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.
%o A281552 (Python)
%o A281552 def a(n):
%o A281552     x= A281149(n)
%o A281552     s=0
%o A281552     for i in range(1,len(x)):
%o A281552         if x[i-1]=="1" and x[i]=="0":
%o A281552             s+=i
%o A281552     return s
%Y A281552 Cf. A049501, A171885, A281149, A281388, A281497.
%K A281552 nonn,base
%O A281552 1,4
%A A281552 _Indranil Ghosh_, Jan 24 2017