login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Describe n in binary, convert to decimal: write in base 10 the binary number concat(c0,0,c1,1) where c0, c1 is the number of '0's and '1's in n, all written in binary.
1

%I #6 Nov 18 2019 16:44:14

%S 9,3,11,5,19,21,21,7,27,37,37,23,37,23,23,9,35,53,53,39,53,39,39,41,

%T 53,39,39,41,39,41,41,11,43,69,69,55,69,55,55,73,69,55,55,73,55,73,73,

%U 43,69,55,55,73,55,73,73,43,55,73,73,43,73,43,43,13,51,85,85,71,85

%N Describe n in binary, convert to decimal: write in base 10 the binary number concat(c0,0,c1,1) where c0, c1 is the number of '0's and '1's in n, all written in binary.

%F a(n+1) = a(n) if n == 1 (mod 4), n > 1.

%e In the binary expansion of n = 0, we have one '0', zero '1's => 1001[2] = 9[10] = a(0).

%e In the binary expansion of n = 1, we have zero '0's, one '1' => 0011 = 3[10] = a(1).

%e In the binary expansion of n = 2 = 10[2], we have one '0', one '1' => 1011[2] = 11[10] = a(2).

%e In the binary expansion of n = 3 = 11[2], we have zero '0's, two (= 10[2]) '1's => a(3) = 00101[2] = 5[10].

%o (PARI) apply( {d(a,b=2)=fromdigits(concat([binary(logint(a+!a,2)+1-a=hammingweight(a)),0,if(a,binary(a)),1]),b)}, [0..99]) \\ 2n optional arg: base in which the string of bits is to be read - i.e., b=10: write it in binary, b=2: convert to decimal!

%Y Cf. A329652 (a(n) written in binary), A010062.

%K nonn,base

%O 0,1

%A _M. F. Hasler_, Nov 18 2019