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).
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
Examples
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; ...
Links
- Paolo Xausa, Table of n, a(n) for n = 0..8190 (rows 0..12 of triangle, flattened).
Crossrefs
Programs
-
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)Alois P. Heinz, Mar 31 2025
-
Mathematica
Table[SortBy[Range[0, 2^n - 1], DigitCount[#, 2, 0] &], {n, 0, 6}]