

A329652


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


2



1001, 11, 1011, 101, 10011, 10101, 10101, 111, 11011, 100101, 100101, 10111, 100101, 10111, 10111, 1001, 100011, 110101, 110101, 100111, 110101, 100111, 100111, 101001, 110101, 100111, 100111, 101001, 100111, 101001, 101001, 1011, 101011, 1000101, 1000101, 110111, 1000101, 110111
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,1


LINKS

Table of n, a(n) for n=0..37.


FORMULA

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


EXAMPLE

In the binary expansion of n = 0, we have one '0', zero '1's => a(0) = 1001.
In the binary expansion of n = 1, we have zero '0's, one '1' => a(0) = 0011 (leading 0's not showing up in DATA).
In the binary expansion of n = 2 = 10[2], we have one '0', one '1' => a(2) = 1011.
In the binary expansion of n = 3 = 11[2], we have zero '0's, two (= 10[2]) '1's => a(2) = 00101 (leading 0's not showing up in DATA).
5 = 101[2] => a(5) = 1 0 10 1.
6 = 110[2] => a(6) = 1 0 10 1: illustration of the formula.


PROG

(PARI) apply( {A329652(a, b=10)=fromdigits(concat([binary(logint(a+!a, 2)+1a=hammingweight(a)), 0, if(a, binary(a)), 1]), b)}, [0..40]) \\ 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!


CROSSREFS

Cf. A329653 (convert a(n) from binary to decimal), A010062.
Sequence in context: A283014 A283058 A283080 * A077493 A290663 A290544
Adjacent sequences: A329649 A329650 A329651 * A329653 A329654 A329655


KEYWORD

nonn,base


AUTHOR

M. F. Hasler, Nov 18 2019


STATUS

approved



