login
A382467
Irregular triangle read by rows, where row n lists the integers from 0 to 2^n - 1 sorted by the number of zeros in their binary representation (in case of ties, by their decimal value).
2
0, 0, 1, 0, 1, 3, 2, 0, 1, 3, 7, 2, 5, 6, 4, 0, 1, 3, 7, 15, 2, 5, 6, 11, 13, 14, 4, 9, 10, 12, 8, 0, 1, 3, 7, 15, 31, 2, 5, 6, 11, 13, 14, 23, 27, 29, 30, 4, 9, 10, 12, 19, 21, 22, 25, 26, 28, 8, 17, 18, 20, 24, 16, 0, 1, 3, 7, 15, 31, 63, 2, 5, 6, 11, 13, 14, 23, 27, 29, 30
OFFSET
0,6
LINKS
Paolo Xausa, Table of n, a(n) for n = 0..8190 (rows 0..12 of triangle, flattened).
EXAMPLE
Triangle begins:
[0] 0;
[1] 0, 1;
[2] 0, 1, 3, 2;
[3] 0, 1, 3, 7, 2, 5, 6, 4;
[4] 0, 1, 3, 7, 15, 2, 5, 6, 11, 13, 14, 4, 9, 10, 12, 8;
...
MAPLE
b:= proc(n) b(n):= add(1-i, i=Bits[Split](n)) end:
T:= n-> sort([$0..2^n-1], (x, y)-> b(x)<b(y) or b(x)=b(y) and x<y)[]:
seq(T(n), n=0..6); # Alois P. Heinz, Mar 31 2025
MATHEMATICA
Table[SortBy[Range[0, 2^n - 1], DigitCount[#, 2, 0] &], {n, 0, 6}]
CROSSREFS
Cf. A080791, A294648 (sorted by number of ones).
Main diagonal gives A000225.
Last elements of rows give A131577.
Row sums give A006516.
Sequence in context: A286223 A341163 A329278 * A348966 A008783 A139144
KEYWORD
nonn,tabf,look,base,easy
AUTHOR
Paolo Xausa, Mar 31 2025
STATUS
approved