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!)
A091444 Concatenate binary vectors ordered first by length, then by the number of 1's and finally lexicographically. 5

%I #11 Aug 15 2021 13:47:03

%S 0,1,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,1,1,0,1,1,1,0,1,1,1,

%T 0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,1,0,1,0,1,0,1,1,0,1,0,

%U 0,1,1,0,1,0,1,1,0,0,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1

%N Concatenate binary vectors ordered first by length, then by the number of 1's and finally lexicographically.

%H Robert P. P. McKone, <a href="/A091444/b091444.txt">Table of n, a(n) for n = 0..18433</a>

%t c[n_, k_] := If[k == 0, {0}, If[k == n, {2^n - 1}, Join[c[n - 1, k], c[n - 1, k - 1] + 2^(n - 1)]]];

%t b[n_] := If[n == 1, {0, 1}, Flatten[Table[c[n, k], {k, 0, n}]]];

%t a[n_] := Map[PadLeft, IntegerDigits[Array[b, n], 2]];

%t a[4] // Flatten (* _Robert P. P. McKone_, Aug 13 2021 *)

%o (Python)

%o from itertools import product

%o def sortby(x): return (len(x), x.count(1), x)

%o def agen(maxvecdigits):

%o for i in range(1, maxvecdigits+1):

%o for t in sorted([p for p in product([0, 1], repeat=i)], key=sortby):

%o yield from t

%o print([an for an in agen(4)]) # _Michael S. Branicky_, Aug 13 2021

%Y Cf. A076478, A091445, A091446, A091447.

%Y Cf. A294648.

%K easy,nonn

%O 0,1

%A _Paul Boddington_, Jan 10 2004

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 September 13 22:05 EDT 2024. Contains 375910 sequences. (Running on oeis4.)