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.

A104346 Triangle read by rows: T(n,k) is the number of alternating max-precedes-min permutations on [n+2] with 1 in position k+2, 0<=k<=n.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 2, 3, 6, 5, 5, 8, 12, 20, 16, 16, 25, 40, 50, 80, 61, 61, 96, 150, 200, 240, 366, 272, 272, 427, 672, 875, 1120, 1281, 1904, 1385, 1385, 2176, 3416, 4480, 5600, 6832, 7616, 11080, 7936, 7936, 12465, 19584, 25620, 32256, 38430, 45696, 49860, 71424, 50521
Offset: 0

Views

Author

David Callan, Mar 02 2005

Keywords

Examples

			Table begins
\ k..0....1....2....3....4....
n
0 |..1
1 |..1....1
2 |..1....2....2
3 |..2....3....6....5
4 |..5....8...12...20...16
5 |.16...25...40...50...80...61
6 |.61...96..150..200..240..366..272
For example, a(3,1) counts 45132, 35142, 25143---the alternating permutations on [5] with 5 preceding 1 and 1 in position 3.
		

Crossrefs

Cf. A104345. Row sums, column k=0 and main diagonal are all A000111.

Programs

  • Maple
    b:= proc(u, o) option remember; `if`(u+o=0, 1,
          add(b(o-1+j, u-j), j=1..u))
        end:
    T:= (n, k)-> binomial(n, k)*b(k+1, 0)*b(n-k, 0):
    seq(seq(T(n, k), k=0..n), n=0..10);  # Alois P. Heinz, Apr 25 2023
  • Mathematica
    b[u_, o_] := b[u, o] = If[u+o == 0, 1, Sum[b[o-1+j, u-j], {j, 1, u}]];
    T[n_, k_] := Binomial[n, k]*b[k+1, 0]*b[n-k, 0];
    Table[Table[T[n, k], {k, 0, n}], {n, 0, 10}] // Flatten (* Jean-François Alcover, Apr 21 2025, after Alois P. Heinz *)

Formula

The mixed e.g.f./o.g.f. is Sum_{k=0..n} T(n, k)*x^n/n!*y^k = (sec(x) + tan(x))*sec(xy)*(sec(xy) + tan(xy)).
T(n,k) = binomial(n,k)*A000111(k+1)*A000111(n-k). - Alois P. Heinz, Apr 25 2023