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.

A357213 Triangular array read by rows: T(n, k) = number of subsets s of {1, 2, ..., n} such max(s) - min(s) = k, for n >= 1, 0 <= k <= n-1.

Original entry on oeis.org

1, 2, 1, 3, 2, 2, 4, 3, 4, 4, 5, 4, 6, 8, 8, 6, 5, 8, 12, 16, 16, 7, 6, 10, 16, 24, 32, 32, 8, 7, 12, 20, 32, 48, 64, 64, 9, 8, 14, 24, 40, 64, 96, 128, 128, 10, 9, 16, 28, 48, 80, 128, 192, 256, 256, 11, 10, 18, 32, 56, 96, 160, 256, 384, 512, 512, 12, 11
Offset: 1

Views

Author

Clark Kimberling, Sep 24 2022

Keywords

Examples

			First 7 rows:
  1
  2     1
  3     2     2
  4     3     4     4
  5     4     6     8    8
  6     5     8    12   16    16
  7     6    10    16   24    32   32
		

Crossrefs

Cf. A000027, A130128 (obtained by deleting the first column), A000225 (row sums).

Programs

  • Mathematica
    s[n_] := s[n] = Subsets[Range[n]]
    u[n_, k_] := u[n, k] = Max[s[n][[k]]] - Min[s[n][[k]]]
    v[n_] := Table[u[n, k], {k, 1, 2^n}];
    t = Table[Count[v[n], i], {n, 1, 14}, {i, 0, n - 1}]
    TableForm[t] (* A357213, array *)
    Flatten[t]   (* A357213, sequence *)
  • PARI
    T(n, k) = my(nb=0); forsubset(n, s, if (#s && (vecmax(s)-vecmin(s) == k), nb++)); nb; \\ Michel Marcus, Sep 26 2022

Formula

The n-th diagonal starts with n, followed by n*A000079(k), for k >= 0.
The columns, excluding the first, are given as in A130128 by T(n,k) = (n-k+1)*2^(k-1), for n >= 1, k >= 1.