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.

A171823 a(n) = base-2 concatenation XYZ, where X = number of bits in binary expansion of n, Y = number of 0's, Z = number of 1's.

Original entry on oeis.org

101, 1011, 10010, 11101, 11110, 11110, 11011, 100111, 1001010, 1001010, 100111, 1001010, 100111, 100111, 1000100, 1011001, 1011110, 1011110, 1011011, 1011110, 1011011, 1011011, 1011100, 1011110, 1011011, 1011011, 1011100, 1011011, 1011100, 1011100
Offset: 1

Views

Author

N. J. A. Sloane, Oct 16 2010

Keywords

Examples

			14 = 1110 in base 2, so X = 4 = 100, Y = 1, Z = 3 = 11, a(14) = 100.1.11 = 100111.
		

Crossrefs

Programs

  • Maple
    F:=proc(n) local t1,t2,t2b,n1,n1b,n0,n0b,t3,t4;
    t1:=convert(n,base,2);
    t2:=nops(t1);
    t2b:=convert(t2,base,2);
    n1:=add(t1[i],i=1..t2);
    n1b:=convert(n1,base,2);
    n0:=t2-n1;
    n0b:=convert(n0,base,2);
    t3:=[
    seq(t2b[nops(t2b)+1-i],i=1..nops(t2b)),
    seq(n0b[nops(n0b)+1-i],i=1..nops(n0b)),
    seq(n1b[nops(n1b)+1-i],i=1..nops(n1b))
    ];
    t4:="";
    for i from 1 to nops(t3) do t4:=cat(t4,t3[i]); od:
    parse(t4);
    end;
  • Mathematica
    a[n_] := IntegerDigits[{z, y} = DigitCount[n, 2]; {y+z, y, z}, 2] // Flatten // FromDigits; Array[a, 30] (* Jean-François Alcover, Oct 20 2016 *)