OFFSET
1,3
COMMENTS
Trailing binary zeros don't affect the run lengths of 1's, so a(2n)=a(n). Trailing isolated binary ones add a run of a single 1, so a(4n+1) = 2*a(n) if a(n) is odd, a(4n+1) = 2*a(n)+1 if a(n) is even. - R. J. Mathar, Dec 07 2010
LINKS
Paul Tek, Table of n, a(n) for n = 1..10000
EXAMPLE
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
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}]
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Dylan Hamilton, Oct 28 2010
EXTENSIONS
Definition rewritten by N. J. A. Sloane, Dec 08 2010.
STATUS
approved