A356028 Irregular triangle {A(n, k)} read by rows, giving in row n the numbers 1, 2, ..., 2^n - 1 ordered according to increasing binary weights, and for like weights decreasing.
1, 2, 1, 3, 4, 2, 1, 6, 5, 3, 7, 8, 4, 2, 1, 12, 10, 9, 6, 5, 3, 14, 13, 11, 7, 15, 16, 8, 4, 2, 1, 24, 20, 18, 17, 12, 10, 9, 6, 5, 3, 28, 26, 25, 22, 21, 19, 14, 13, 11, 7, 30, 29, 27, 23, 15, 31, 32, 16, 8, 4, 2, 1, 48, 40, 36, 34, 33, 24, 20, 18, 17, 12, 10, 9, 6, 5, 3, 56, 52, 50, 49, 44, 42, 41, 38, 37, 35, 28, 26, 25, 22, 21, 19, 14, 13, 11, 7, 60, 58, 57, 54, 53, 51, 46, 45, 43, 39, 30, 29, 27, 23, 15, 62, 61, 59, 55, 47, 31, 63
Offset: 1
Examples
The irregular triangle A begins (commas separate the n subsequences for m = 1, 2, ..., n, corresponding to the binary encoded choose(n, m) lists or binary weights m): n\k 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... 1: 1 2: 2 1, 3 3: 4 2 1, 6 5 3, 7 4: 8 4 2 1, 12 10 9 6 5 3, 14 13 11 7, 15 ... n = 5: [16 8 4 2 1, 24 20 18 17 12 10 9 6 5 3, 28 26 25 22 21 19 14 13 11 7, 30 29 27 23 15, 31]; n = 6: [32 16 8 4 2 1, 48 40 36 34 33 24 20 18 17 12 10 9 6 5 3, 56 52 50 49 44 42 41 38 37 35 28 26 25 22 21 19 14 13 11 7, 60 58 57 54 53 51 46 45 43 39 30 29 27 23 15, 62 61 59 55 47 31, 63); ... A(4, 2) gives the number with the binary representation of the choose([4], 2) list [[1,1,0,0], [1,0,1,0], [1,0,0,1], [0,1,1,0], [0,1,0,1], [0,0,1,1]], obtained from the list choose([4], 2) = [[1,2], [1,3], [1,4], [2,3], [2,4], [3,4]], that is [12, 10, 9, 6, 5, 3]. A(4, 2) from the numbers 1, 2, ..., 15 with binary weight 2, that is of 3, 5, 6, 9, 10, 12, in decreasing order: 12, 10, 9, 6, 5, 3.
Links
- Paolo Xausa, Table of n, a(n) for n = 1..8178 (rows 1..12 of the triangle, flattened).
Programs
-
Mathematica
A356028row[n_]:=SortBy[Range[2^n-1],{DigitCount[#,2,1]&,-#&}]; Array[A356028row,6] (* Paolo Xausa, Dec 20 2023 *)
-
PARI
cmph(x, y) = my(d=hammingweight(x)-hammingweight(y)); if (d, d, y-x); row(n) = my(v=[1..2^n-1]); vecsort(v, cmph); \\ Michel Marcus, Sep 16 2023
Extensions
Name suggested by Kevin Ryde.
Comments