%I #20 Nov 17 2024 08:30:13
%S 1,1,1,1,2,-1,1,3,-3,-2,1,4,-6,-8,5,1,5,-10,-20,25,16,1,6,-15,-40,75,
%T 96,-61,1,7,-21,-70,175,336,-427,-272,1,8,-28,-112,350,896,-1708,
%U -2176,1385,1,9,-36,-168,630,2016,-5124,-9792,12465,7936
%N Triangle read by rows. T(n, k) = A081658(n, k) + A363393(n, k) for k > 0 and T(n, 0) = 1.
%H Richard P. Stanley, <a href="https://doi.org/10.48550/arXiv.0912.4240">A survey of alternating permutations</a>, arXiv:0912.4240 [math.CO], 2009.
%H <a href="/index/Eu#Euler">Index entries for sequences related to Euler numbers.</a>
%F |T(n, k)| = (-1)^(n - k) * n! * [x^(n - k)][y^n] (sec(y) + tan(y)) / exp(x*y).
%F T(n, k) = [x^(n - k)] -2^(k-(0^k))*(Euler(k, 0) + Euler(k, 1/2)) / (x-1)^(k + 1).
%F For a recursion see the Python program.
%F T(n, k) = [x^n] ((-1) + Sum_{j=0..n} binomial(n, j)*(Euler(j, 1) + Euler(j, 1/2))*(2*x)^j). - _Peter Luschny_, Nov 17 2024
%e The triangle T(n, k) begins:
%e [0] 1;
%e [1] 1, 1;
%e [2] 1, 2, -1;
%e [3] 1, 3, -3, -2;
%e [4] 1, 4, -6, -8, 5;
%e [5] 1, 5, -10, -20, 25, 16;
%e [6] 1, 6, -15, -40, 75, 96, -61;
%e [7] 1, 7, -21, -70, 175, 336, -427, -272;
%e [8] 1, 8, -28, -112, 350, 896, -1708, -2176, 1385;
%e [9] 1, 9, -36, -168, 630, 2016, -5124, -9792, 12465, 7936;
%p # Variant, computes abs(T(n, k)):
%p P := n -> n!*coeff(series((sec(y) + tan(y))/exp(x*y), y, 24), y, n):
%p seq(print(seq((-1)^(n - k)*coeff(P(n), x, n - k), k = 0..n)), n = 0..9);
%o (Python)
%o from functools import cache
%o @cache
%o def T(n: int, k: int) -> int:
%o if k == 0: return 1
%o if k == n:
%o p = k % 2
%o return p - sum(T(n, j) for j in range(p, n - 1, 2))
%o return (T(n - 1, k) * n) // (n - k)
%o for n in range(10): print([T(n, k) for k in range(n + 1)])
%Y Variants (row reversed): A109449, A247453.
%Y Cf. A081658 (signed secant part), A363393 (signed tangent part), A000111 (main diagonal), A122045, A155585 (aerated main diagonal), A000667, A062162 (row sums of signless variant).
%K sign,tabl,changed
%O 0,5
%A _Peter Luschny_, Jun 06 2023