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.

A368519 Irregular triangular array T, read by rows: T(n,k) = number of sums |x-y|+|y-z| = k, where x,y,z are in {1,2,...,n} and x < z.

Original entry on oeis.org

2, 4, 3, 2, 6, 6, 8, 2, 2, 8, 9, 14, 9, 6, 2, 2, 10, 12, 20, 16, 16, 6, 6, 2, 2, 12, 15, 26, 23, 26, 17, 12, 6, 6, 2, 2, 14, 18, 32, 30, 36, 28, 26, 12, 12, 6, 6, 2, 2, 16, 21, 38, 37, 46, 39, 40, 27, 20, 12, 12, 6, 6, 2, 2, 18, 24, 44, 44, 56, 50, 54, 42
Offset: 1

Views

Author

Clark Kimberling, Jan 22 2024

Keywords

Comments

Row n consists of 2n-1 positive integers.

Examples

			First six rows:
   2
   4   3    2
   6   6    8   2   2
   8   9   14   9   6   2   2
   10  12  20  16  16   6   6  2  2
   12  15  26  23  26  17  12  6  6  2  2
For n=3, there are 9 triples (x,y,z) having x < z:
112:  |x-y| + |y-z| = 1
113:  |x-y| + |y-z| = 2
122:  |x-y| + |y-z| = 1
123:  |x-y| + |y-z| = 2
132:  |x-y| + |y-z| = 3
133:  |x-y| + |y-z| = 2
213:  |x-y| + |y-z| = 3
223:  |x-y| + |y-z| = 1
233:  |x-y| + |y-z| = 1,
so that row 1 of the array is (4,3,2), representing four 1s, three 2s, and two 3s.
		

Crossrefs

Cf. A006002 (row sums), A110660 (limiting reverse row), A368434, A368437, A368515, A368516, A368517, A368518, A368520, A368521, A368522.

Programs

  • Mathematica
    t1[n_] := t1[n] = Tuples[Range[n], 3];
    t[n_] := t[n] = Select[t1[n], #[[1]] < #[[3]] &];
    a[n_, k_] := Select[t[n], Abs[#[[1]] - #[[2]]] + Abs[#[[2]] - #[[3]]] == k &];
    u = Table[Length[a[n, k]], {n, 2, 15}, {k, 1, 2 n - 3}];
    v = Flatten[u];  (* sequence *)
    Column[Table[Length[a[n, k]], {n, 2, 15}, {k, 1, 2 n - 3}]]  (* array *)