OFFSET
1,2
COMMENTS
EXAMPLE
n=9 is 1001 in binary. Run lengths of 0's are 2 (one run of length 2) and of 1's are 11 (two runs each of length 1). The concatenation of these lengths is 211, which is interpreted as 2 one's, 1 zero, 1 one, binary 1101, and recoded decimal as a(9)=8+4+1 =13.
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[Flatten[{zerobinrep[n], onebinrep[n]}]], {n, START, END}]
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Dylan Hamilton, Oct 28 2010
STATUS
approved