Displaying 1-2 of 2 results found.
page
1
0, 1, 2, 3, 3, 5, 6, 7, 7, 7, 7, 11, 11, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 23, 23, 23, 23, 27, 27, 29, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 47, 47, 47, 47, 47, 47, 47, 47, 55, 55, 55, 55, 59, 59, 61, 62, 63, 63, 63, 63, 63
COMMENTS
It appears that the sequence of unique terms is A089633, and that their run lengths are 1, 1, 1, 2, 1, 1, 4, 2, 1, 1, 8, ...: A155038.
MATHEMATICA
Last /@ Table[SortBy[Range@ k, And[Total@ IntegerDigits[#, 2], k] &], {k, 67}] (* Michael De Vlieger, Oct 04 2015 *)
PROG
(PARI) cmph(i, j) = if (hammingweight(i) != hammingweight(j), hammingweight(i) - hammingweight(j), i - j);
row(n) = my(v = vector(n+1, k, k-1)); vecsort(v, cmph);
lista(nn) = {for (n=0, nn, my(r = srow(n)); print1(r[#r], ", "); ); }
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.
+10
3
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
COMMENTS
The length of row n is 2^n - 1 = A000225(n).
Also irregular triangle {A(n, k)} read by rows, giving in row n the numbers with a binary encoding of the list choose([n], m) = choose({1, 2,..., n}, m) (each encoding of length n), for n >= 1 and m = 1, 2, ..., n; written as entries for k = 1, 2, ..., 2^n - 1.
The binary encoding is obtained by setting 1s at the positions given by the choose([n],m) list of lists (in lexicographic order) and 0 otherwise. E.g., choose([3], 2) = [[1, 2], [1, 3], [2, 3]] with the encodings of length 3 [[1, 1, 0], [1, 0, 1], [0, 1, 1]], read as base 2 lists giving the numbers [6, 5, 3].
For the triangle T(n,m) of the sums of like m entries see A134346, (using offset 1).
EXAMPLE
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.
MATHEMATICA
A356028row[n_]:=SortBy[Range[2^n-1], {DigitCount[#, 2, 1]&, -#&}];
PROG
(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
Search completed in 0.007 seconds
|