login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Take n written in binary. Replace the leftmost run of 1's with just a single 1. a(n) is the decimal equivalent of the result.
1

%I #16 Jul 27 2017 19:27:16

%S 1,2,1,4,5,2,1,8,9,10,11,4,5,2,1,16,17,18,19,20,21,22,23,8,9,10,11,4,

%T 5,2,1,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,16,17,18,19,20,

%U 21,22,23,8,9,10,11,4,5,2,1,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78

%N Take n written in binary. Replace the leftmost run of 1's with just a single 1. a(n) is the decimal equivalent of the result.

%H G. C. Greubel, <a href="/A163509/b163509.txt">Table of n, a(n) for n = 1..1000</a>

%e 29 in binary is 11101. Replace the three 1's on the left of the binary representation with one 1, getting 101. a(29) is the decimal equivalent of the result, which is 5.

%p A163509 := proc(n) bdgs := convert(n,base,2) ; while op(-1,bdgs) = op(-2,bdgs) do bdgs := subsop(-1=NULL,bdgs) ; od: add( op(d,bdgs)*2^(d-1),d=1..nops(bdgs) ) ; end: seq(A163509(n),n=1..120) ; # _R. J. Mathar_, Aug 07 2009

%t Table[FromDigits[Flatten[Join[{1},Rest[Split[IntegerDigits[n,2]]]]],2],{n,80}] (* _Harvey P. Dale_, Jul 17 2014 *)

%K base,look,nonn

%O 1,2

%A _Leroy Quet_, Jul 29 2009

%E More terms from _R. J. Mathar_, Aug 07 2009