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.

A162979 Triangle read by rows: T(n,k) is the number of alternating (i.e., down-up) permutations of {1,2,...,n} having k fixed points (n >= 0, 0 <= k <= ceiling(n/2)).

Original entry on oeis.org

1, 0, 1, 1, 0, 1, 1, 0, 2, 2, 1, 6, 6, 3, 1, 24, 24, 11, 2, 102, 102, 51, 15, 2, 528, 528, 252, 68, 9, 2952, 2952, 1476, 458, 89, 9, 19008, 19008, 9240, 2728, 493, 44, 131112, 131112, 65556, 20868, 4479, 621, 44, 1009728, 1009728, 495360, 152448, 31182, 4054, 265, 8271792, 8271792, 4135896, 1334928, 300954, 47670, 4959, 265
Offset: 0

Views

Author

Emeric Deutsch, Aug 06 2009

Keywords

Comments

Sum of entries in row n is the Euler (up-down) number A000111(n).
T(n,0) = T(n,1) = A129817(n) (n>=1).
T(2n,n) = T(2n+1,n+1) = d(n), where d(n) = A000166 is a derangement number (see the Chapman & Williams reference).
Sum_{k>=0} k*T(n,k) = A162978(n).

Examples

			T(5,2)=3 because we have 32415, 41325, and 52314.
Triangle starts:
    1;
    0,   1;
    1,   0;
    1,   1,   0;
    2,   2,   1;
    6,   6,   3,   1;
   24,  24,  11,   2;
  102, 102,  51,  15,   2;
		

Crossrefs

Programs

  • Maple
    fo := exp(E*(arctan(q*t)-arctan(t)))/(1-E*t): fe := sqrt((1+t^2)/(1+q^2*t^2))*exp(E*(arctan(q*t)-arctan(t)))/(1-E*t): foser := simplify(series(fo, t = 0, 18)): feser := simplify(series(fe, t = 0, 18)): Q := proc (n) if `mod`(n, 2) = 1 then coeff(foser, t, n) else coeff(feser, t, n) end if end proc: for n from 0 to 16 do Q(n) end do: g := sec(x)+tan(x): gser := series(g, x = 0, 20): for n from 0 to 18 do a[n] := factorial(n)*coeff(gser, x, n) end do: for n from 0 to 15 do P[n] := sort(subs({E^14 = a[14], E^15 = a[15], E^16 = a[16], E = a[1], E^2 = a[2], E^3 = a[3], E^4 = a[4], E^5 = a[5], E^6 = a[6], E^7 = a[7], E^8 = a[8], E^9 = a[9], E^10 = a[10], E^11 = a[11], E^12 = a[12], E^13 = a[13]}, Q(n))) end do: for n from 0 to 13 do seq(coeff(P[n], q, j), j = 0 .. ceil((1/2)*n)) end do;
  • Mathematica
    nmax = 13;
    fo = Exp[e*(ArcTan[q*t] - ArcTan[t])]/(1 - e*t);
    fe = Sqrt[(1+t^2)/(1+q^2*t^2)]*Exp[e*(ArcTan[q*t] - ArcTan[t])]/(1-e*t);
    Q[n_] := If [OddQ[n], SeriesCoefficient[fo, {t, 0, n}],  SeriesCoefficient[fe, {t, 0, n}]] // Expand;
    a[n_] := n!*SeriesCoefficient[Sec[x] + Tan[x], {x, 0, n}];
    P[n_] := (Q[n] /. e^k_Integer :> a[k]) /. e :> a[1] // Expand;
    Table[Switch[n, 0, {1}, 1, {0, 1}, 2, {1, 0}, 3, {1, 1, 0}, , CoefficientList[P[n], q]] , {n, 0, nmax}] // Flatten (* _Jean-François Alcover, Jul 23 2018, from Maple *)

Formula

The row generating polynomials can be obtained from Proposition 6.1 of the Stanley reference (see the Maple program).