|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|