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”).

A163509
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
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, 5, 2, 1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 16, 17, 18, 19, 20, 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
OFFSET
1,2
LINKS
EXAMPLE
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.
MAPLE
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
MATHEMATICA
Table[FromDigits[Flatten[Join[{1}, Rest[Split[IntegerDigits[n, 2]]]]], 2], {n, 80}] (* Harvey P. Dale, Jul 17 2014 *)
CROSSREFS
Sequence in context: A371015 A090077 A229763 * A161399 A318479 A053985
KEYWORD
base,look,nonn
AUTHOR
Leroy Quet, Jul 29 2009
EXTENSIONS
More terms from R. J. Mathar, Aug 07 2009
STATUS
approved