OFFSET
1,4
COMMENTS
A variant of A175945, where in the first (analyzing) step not the runs of 1's but the runs of 0's determine the list of run lengths. The second (synthesizing) step is the same in both sequences. - R. J. Mathar, May 28 2011
LINKS
Paul Tek, Table of n, a(n) for n = 1..10000
EXAMPLE
From R. J. Mathar, May 28 2011: (Start)
N=16 is 10000 in binary which has one run of 4 zeros, and its run-length encoding is 4. This is interpreted as one run of 4 one's, 1111, which back to decimal is a(16)=15.
N=14 is 1110 in binary which has one run of 1 zero, and its run-length encoding is 1. This is interpreted as one run of 1 one, 1, which is in decimal a(14)=1.
N=19 is 10011 in binary which has one run of 2 zeros, and its run-length encoding is 2. This is interpreted as one run of 2 ones, 11, which back to decimal is a(19)=3. (End)
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[zerobinrep[n]], {n, START, END}]
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Dylan Hamilton, Oct 28 2010
STATUS
approved