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.

This page as a plain text file.
%I A171823 #5 Oct 20 2016 03:47:53
%S A171823 101,1011,10010,11101,11110,11110,11011,100111,1001010,1001010,100111,
%T A171823 1001010,100111,100111,1000100,1011001,1011110,1011110,1011011,
%U A171823 1011110,1011011,1011011,1011100,1011110,1011011,1011011,1011100,1011011,1011100,1011100
%N 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.
%e A171823 14 = 1110 in base 2, so X = 4 = 100, Y = 1, Z = 3 = 11, a(14) = 100.1.11 = 100111.
%p A171823 F:=proc(n) local t1,t2,t2b,n1,n1b,n0,n0b,t3,t4;
%p A171823 t1:=convert(n,base,2);
%p A171823 t2:=nops(t1);
%p A171823 t2b:=convert(t2,base,2);
%p A171823 n1:=add(t1[i],i=1..t2);
%p A171823 n1b:=convert(n1,base,2);
%p A171823 n0:=t2-n1;
%p A171823 n0b:=convert(n0,base,2);
%p A171823 t3:=[
%p A171823 seq(t2b[nops(t2b)+1-i],i=1..nops(t2b)),
%p A171823 seq(n0b[nops(n0b)+1-i],i=1..nops(n0b)),
%p A171823 seq(n1b[nops(n1b)+1-i],i=1..nops(n1b))
%p A171823 ];
%p A171823 t4:="";
%p A171823 for i from 1 to nops(t3) do t4:=cat(t4,t3[i]); od:
%p A171823 parse(t4);
%p A171823 end;
%t A171823 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 *)
%Y A171823 Cf. A171825, A171798, A171813.
%K A171823 nonn,base
%O A171823 1,1
%A A171823 _N. J. A. Sloane_, Oct 16 2010