%I #107 Dec 02 2023 11:04:24
%S 1,2,4,16,80,512,3904,34816,354560,4063232,51733504,724566016,
%T 11070525440,183240753152,3266330312704,62382319599616,
%U 1270842139934720,27507470234550272,630424777638805504,15250953398036463616,388362339077351014400,10384044045105304174592
%N Expansion of e.g.f. (1 + tan(x))/(1 - tan(x)).
%H Alois P. Heinz, <a href="/A000831/b000831.txt">Table of n, a(n) for n = 0..432</a> (first 84 terms from R. J. Mathar)
%H William Y. C. Chen and Amy M. Fu, <a href="https://arxiv.org/abs/2204.01497">The Dumont Ansatz for the Eulerian Polynomials, Peak Polynomials and Derivative Polynomials</a>, arXiv:2204.01497 [math.CO], 2022.
%H D. Dumont, <a href="http://dx.doi.org/10.1006/aama.1995.1014">Further triangles of Seidel-Arnold type and continued fractions related to Euler and Springer numbers</a>, Adv. Appl. Math., 16 (1995), 275-296.
%H M. S. Tokmachev, <a href="https://vestnik.susu.ru/mmph/article/viewFile/8337/6806">Correlations Between Elements and Sequences in a Numerical Prism</a>, Bulletin of the South Ural State University, Ser. Mathematics. Mechanics. Physics, 2019, Vol. 11, No. 1, 24-33.
%F E.g.f.: tan(x+Pi/4).
%F a(n) = Sum_{k=1..n} (if even(n+k) ( (-1)^((n+k)/2)*Sum_{j=k..n} (j!*stirling2(n,j)*2^(n-j+1)*(-1)^(j)*binomial(j-1,k-1) ), n>0. - _Vladimir Kruchinin_, Aug 19 2010
%F a(n) = 4^n*(E_{n}(1/2) + E_{n}(1))*(-1)^((n^2-n)/2) for n > 0, where E_{n}(x) is an Euler polynomial. - _Peter Luschny_, Nov 24 2010
%F a(n) = 2^n * A000111(n). - _Gerard P. Michon_, Feb 24 2011
%F From _Sergei N. Gladkovskii_, Dec 01 2011 - Jan 24 2014: (Start)
%F Continued fractions:
%F E.g.f.: -1 + 2/(1-x*G(0)); G(k) = 1 - (x^2)/((x^2) - (2*k + 1)*(2*k + 3)/G(k+1)).
%F E.g.f.: 1 + 2*x/(U(0)-2*x) where U(k) = 4*k+1 + x/(1+x/ (4*k+3 - x/(1- x/U(k+1)))).
%F E.g.f.: 1 + 2*x/(G(0)-x) where G(k) = 2*k+1 - x^2/G(k+1).
%F G.f.: 1 + 2*x/Q(0), where Q(k) = 1 - 2*x*(2*k+1) - 2*x^2*(2*k+1)*(2*k+2)/( 1 - 2*x*(2*k+2) - 2*x^2*(2*k+2)*(2*k+3)/Q(k+1)).
%F E.g.f.: tan(2*x) + sec(2*x) = (x-1)/(x+1) - 2*(2*x^2+3)/( T(0)*3*x*(1+x)- 2*x^2-3)/(x+1), where T(k) = 1 - x^4*(4*k-1)*(4*k+7)/( x^4*(4*k-1)*(4*k+7) - (4*k+1)*(4*k+5)*(16*k^2 + 8*k - 2*x^2 - 3)*(16*k^2 + 40*k - 2*x^2 + 21)/T(k+1)).
%F E.g.f.: 1 + 2*x/Q(0), where Q(k) = 4*k+1 -x/(1 - x/( 4*k+3 + x/(1 + x/Q(k+1)))).
%F E.g.f.: tan(2*x) + sec(2*x) = 2*R(0)-1, where R(k) = 1 + x/( 4*k+1 - x/(1 - x/( 4*k+3 + x/R(k+1)))).
%F G.f.: 1+ G(0)*2*x/(1-2*x), where G(k) = 1 - 2*x^2*(k+1)*(k+2)/(2*x^2*(k+1)*(k+2) - (1-2*x*(k+1))*(1-2*x*(k+2))/G(k+1)). (End)
%F a(n) ~ n! * (4/Pi)^(n+1). - _Vaclav Kotesovec_, Jun 15 2015
%F a(0) = 1; a(n) = 2 * Sum_{k=0..n-1} binomial(n-2,k) * a(k) * a(n-k-1). - _Ilya Gutkovskiy_, Jun 11 2020
%e (1+tan x)/(1-tan x) = 1 + 2*x/1! + 4*x^2/2! + 16*x^3/3! + 80*x^4/4! + 512*x^5/5! + ...
%p A000831 := (1+tan(x))/(1-tan(x)) : for n from 0 to 200 do printf("%d %d ",n,n!*coeftayl(A000831,x=0,n)) ; end: # _R. J. Mathar_, Nov 19 2006
%p A000831 := n -> `if`(n=0,1,(-1)^((n^2-n)/2)*4^n*(euler(n,1/2)+euler( n,1))): # _Peter Luschny_, Nov 24 2010
%p # third Maple program:
%p b:= proc(u, o) option remember;
%p `if`(u+o=0, 1, 2*add(b(o-1+j, u-j), j=1..u))
%p end:
%p a:= n-> b(n, 0):
%p seq(a(n), n=0..25); # _Alois P. Heinz_, Sep 02 2020
%t Range[0, 18]! CoefficientList[Series[(1+Tan[x])/(1-Tan[x]), {x,0,18}], x] (* _Robert G. Wilson v_, Apr 16 2011 *)
%t b[u_, o_] := b[u, o] = If[u+o == 0, 1, 2*Sum[b[o-1+j, u-j], {j, 1, u}]];
%t a[n_] := b[n, 0];
%t Table[a[n], {n, 0, 25}] (* _Jean-François Alcover_, Dec 02 2023, after _Alois P. Heinz_ *)
%o (PARI) a(n) = if( n<1, n==0, n! * polcoeff( 1 + 2 / ( 1 / tan( x + x * O(x^n)) - 1), n)) /* _Michael Somos_, Apr 16 2011 */
%o (PARI) a(n) = local(A); if( n<0, 0, A = x * O(x^n); n! * polcoeff( (cos(x + A) + sin(x + A)) / (cos(x + A) - sin(x + A)), n)) /* _Michael Somos_, Apr 16 2011 */
%o (Maxima) a(n):=sum(if evenp(n+k) then ((-1)^((n+k)/2)*sum(j!*stirling2(n,j)*2^(n-j+1)*(-1)^(j)*binomial(j-1,k-1),j,k,n)) else 0,k,1,n); /* _Vladimir Kruchinin_, Aug 19 2010 */
%o (Sage)
%o @CachedFunction
%o def sp(n,x) :
%o if n == 0 : return 1
%o return -add(2^(n-k)*sp(k,1/2)*binomial(n,k) for k in range(n)[::2])
%o A000831 = lambda n : abs(sp(n,x))
%o [A000831(n) for n in (0..21)] # _Peter Luschny_, Jul 30 2012
%o (SageMath)
%o def A000831_list(prec):
%o P.<x> = PowerSeriesRing(QQ, prec)
%o return P( (1+tan(x))/(1-tan(x)) ).egf_to_ogf().list()
%o A000831_list(40) # _G. C. Greubel_, Mar 21 2019; Apr 28 2023
%o (Magma) m:=30; R<x>:=PowerSeriesRing(Rationals(), m);
%o Coefficients(R!(Laplace( (1+Tan(x))/(1-Tan(x)) ))); // _G. C. Greubel_, Mar 21 2019; Apr 28 2023
%Y Bisections: A002436 and A012393.
%Y Cf. A000111, A000182, A155100, A258880, A258901, A258994.
%K nonn
%O 0,2
%A _N. J. A. Sloane_