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.

A357329 Triangular array read by rows: T(n, k) = number of occurrences of 2k as a sum |1 - p(1)| + |2 - p(2)| + ... + |n - p(n)|, where (p(1), p(2), ..., p(n)) ranges through the permutations of (1,2,...,n), for n >= 1, 0 <= k <= n-1.

Original entry on oeis.org

1, 1, 1, 1, 2, 3, 1, 3, 7, 9, 1, 4, 12, 24, 35, 1, 5, 18, 46, 93, 137, 1, 6, 25, 76, 187, 366, 591, 1, 7, 33, 115, 327, 765, 1523, 2553, 1, 8, 42, 164, 524, 1400, 3226, 6436, 11323, 1, 9, 52, 224, 790, 2350, 6072, 13768, 27821, 50461, 1, 10, 63, 296, 1138, 3708, 10538, 26480, 59673, 121626, 226787
Offset: 1

Views

Author

Clark Kimberling, Sep 24 2022

Keywords

Comments

In the Name, (1,2,...,n) can be replaced by any of its permutations. The first 10 row sums are the first 10 terms of A263898.

Examples

			First 8 rows:
  1
  1     1
  1     2     3
  1     3     7     9
  1     4    12    24     35
  1     5    18    46     93     137
  1     6    25    76    187     366    591
  1     7    33   115    327     765   1523    2553
For n=3, write
  123   123   123   123   123   123
  123   132   213   231   312   312
  000   011   110   112   211   211,
where row 3 represents |1 - p(1)| + |2 - p(2)| + |3 - p(n)| for the 6 permutations (p(1), p(2), p(2)) in row 3. The sums in row 3 are 0,2,2,4,4,4, so that the numbers 0, 2, 4 occur with multiplicities 1, 2, 3, as in row 3 of the array.
		

Crossrefs

Subtriangle of A062869.
T(2n,n) gives A072948 (for n>0).

Programs

  • Maple
    g:= proc(h, n) local i, j; j:= irem(h, 2, 'i');
           1-`if`(h=n, 0, (i+1)*z*t^(i+j)/g(h+1, n))
        end:
    T:= n-> (p-> seq(coeff(p, t, k), k=0..n-1))
            (coeff(series(1/g(0, n), z, n+1), z, n)):
    seq(T(n), n=1..12);  # Alois P. Heinz, Oct 02 2022
  • Mathematica
    p[n_] := p[n] = Permutations[Range[n]];
    f[n_, k_] := f[n, k] = Abs[p[n][[k]] - Range[n]]
    c[n_, k_] := c[n, k] = Total[f[n, k]]
    t[n_] := Table[c[n, k], {k, 1, n!}]
    u = Table[Count[t[n], 2 m], {n, 1, 10}, {m, 0, n - 1}]  (* A357329, array *)
    Flatten[u]  (* A357329, sequence *)