A175945 Start with the binary expansion of n; list the lengths of the runs of ones and interpret this list as lengths of runs of alternating ones and zeros in binary.
1, 1, 3, 1, 2, 3, 7, 1, 2, 2, 4, 3, 6, 7, 15, 1, 2, 2, 4, 2, 5, 4, 8, 3, 6, 6, 12, 7, 14, 15, 31, 1, 2, 2, 4, 2, 5, 4, 8, 2, 5, 5, 11, 4, 9, 8, 16, 3, 6, 6, 12, 6, 13, 12, 24, 7, 14, 14, 28, 15, 30, 31, 63, 1, 2, 2, 4, 2, 5, 4, 8, 2, 5, 5, 11, 4, 9, 8, 16, 2, 5, 5, 11, 5, 10, 11, 23, 4, 9, 9, 19, 8, 17
Offset: 1
Examples
n=43 in binary is 101011, where the 1 has run-lengths of 1, 1 and 2. This is interpreted as a run of 1 one, run of 1 zero and run of 2 one's, 1011, which back to decimal is a(43)=11. - _R. J. Mathar_, Dec 07 2010
Links
- Paul Tek, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
takelist[l_, t_] := Module[{lent, term},Set[lent, Length[t]]; Table[l[[t[[y]]]], {y, 1, lent}]] frombinrep[x_] := FromDigits[Flatten[Table[Table[If[OddQ[n], 1, 0], {d, 1, x[[n]]}], {n, 1, Length[x]}]], 2] binrep[x_] := repcount[IntegerDigits[x, 2]] onebinrep[x_]:=Module[{b},b=binrep[x];takelist[b,Range[1,Length[b],2]]] zerobinrep[x_]:=Module[{b},b=binrep[x];takelist[b,Range[2,Length[b],2]]] Table[frombinrep[onebinrep[n]], {n,START,END}]
Extensions
Definition rewritten by N. J. A. Sloane, Dec 08 2010.
Comments