cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Wolfdieter Lang, Jul 27 2022

Keywords

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).
The sum of row n gives A006516(n) = A171476(n-1), for n >= 1 (see A134346).

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.
		

Crossrefs

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.