A175946 List the run lengths of n's binary runs of zeros, then interpret this list as lengths of runs of alternating ones and zeros in binary.
0, 1, 0, 3, 1, 1, 0, 7, 3, 2, 1, 3, 1, 1, 0, 15, 7, 6, 3, 4, 2, 2, 1, 7, 3, 2, 1, 3, 1, 1, 0, 31, 15, 14, 7, 12, 6, 6, 3, 8, 4, 5, 2, 4, 2, 2, 1, 15, 7, 6, 3, 4, 2, 2, 1, 7, 3, 2, 1, 3, 1, 1, 0, 63, 31, 30, 15, 28, 14, 14, 7, 24, 12, 13, 6, 12, 6, 6, 3, 16, 8, 9, 4, 11, 5, 5, 2, 8, 4, 5, 2, 4, 2, 2, 1
Offset: 1
Examples
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)
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[zerobinrep[n]], {n,START,END}]
Comments