login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I #7 Nov 18 2019 16:44:08

%S 1001,11,1011,101,10011,10101,10101,111,11011,100101,100101,10111,

%T 100101,10111,10111,1001,100011,110101,110101,100111,110101,100111,

%U 100111,101001,110101,100111,100111,101001,100111,101001,101001,1011,101011,1000101,1000101,110111,1000101,110111

%N 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.

%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 => a(0) = 1001.

%e 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).

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

%e 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).

%e 5 = 101[2] => a(5) = 1 0 10 1.

%e 6 = 110[2] => a(6) = 1 0 10 1: illustration of the formula.

%o (PARI) apply( {A329652(a,b=10)=fromdigits(concat([binary(logint(a+!a,2)+1-a=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!

%Y Cf. A329653 (convert a(n) from binary to decimal), A010062.

%K nonn,base

%O 0,1

%A _M. F. Hasler_, Nov 18 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 31 04:08 EDT 2024. Contains 375550 sequences. (Running on oeis4.)