cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Dylan Hamilton, Oct 28 2010

Keywords

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

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)
		

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}]