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.

A368516 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 != y and y != z.

Original entry on oeis.org

2, 6, 4, 2, 10, 12, 8, 4, 2, 14, 20, 20, 12, 8, 4, 2, 18, 28, 32, 28, 18, 12, 8, 4, 2, 22, 36, 44, 44, 38, 24, 18, 12, 8, 4, 2, 26, 44, 56, 60, 58, 48, 32, 24, 18, 12, 8, 4, 2, 30, 52, 68, 76, 78, 72, 60, 40, 32, 24, 18, 12, 8, 4, 2, 34, 60, 80, 92, 98, 96
Offset: 1

Views

Author

Clark Kimberling, Dec 31 2023

Keywords

Comments

Row n consists of 2n-1 even positive integers.

Examples

			First six rows:
   2
   6    4    2
  10   12    8    4    2
  14   20   20   12    8    4    2
  18   28   32   28   18   12    8    4   2
  22   36   44   44   38   24   18   12   8   4   2
For n=3, there are 12 triples (x,y,z) having x != y and y != z:
  121:  |x-y| + |y-z| = 2
  123:  |x-y| + |y-z| = 2
  131:  |x-y| + |y-z| = 4
  132:  |x-y| + |y-z| = 3
  212:  |x-y| + |y-z| = 2
  213:  |x-y| + |y-z| = 3
  231:  |x-y| + |y-z| = 3
  232:  |x-y| + |y-z| = 2
  312:  |x-y| + |y-z| = 3
  313:  |x-y| + |y-z| = 4
  321:  |x-y| + |y-z| = 2
  323:  |x-y| + |y-z| = 2,
so that row 2 of the array is (6,4,2), representing six 2s, four 3s, and two 4s.
		

Crossrefs

Cf. A011379 (row sums), A007590 (limiting reverse row), A368434, A368437, A368515, A368517, A368518, A368519, A368520, A368521, A368522.

Programs

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