A104345 Triangle read by rows: T(n,k) is the number of alternating permutations on [n+1] with 1 in position k+1, 0<=k<=n.
1, 1, 1, 1, 2, 1, 2, 3, 3, 2, 5, 8, 6, 8, 5, 16, 25, 20, 20, 25, 16, 61, 96, 75, 80, 75, 96, 61, 272, 427, 336, 350, 350, 336, 427, 272, 1385, 2176, 1708, 1792, 1750, 1792, 1708, 2176, 1385, 7936, 12465, 9792, 10248, 10080, 10080, 10248, 9792, 12465, 7936
Offset: 0
Examples
Table begins \ k..0....1....2....3....4.... n 0 |..1 1 |..1....1 2 |..1....2....1 3 |..2....3....3....2 4 |..5....8....6....8....5 5 |.16...25...20...20...25...16 6 |.61...96...75...80...75...96...61 7 |272..427..336..350..350..336..427..272 For example, T(3,1) counts 2143, 3142, 4132 - the alternating permutations on [4] with 1 in position 2.
Links
- Alois P. Heinz, Rows n = 0..150, flattened
Crossrefs
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, 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, 0]*b[n-k, 0]; Table[Table[T[n, k], {k, 0, n}], {n, 0, 10}] // Flatten (* Jean-François Alcover, Apr 01 2024, after Alois P. Heinz *)
Formula
The mixed o.g.f./e.g.f. is Sum_{k=0..n} T(n, k)*x^n/n!*y^k = (sec(x) + tan(x))*(sec(x*y) + tan(x*y)).