Summation Formula for Tangent/Secant Numbers I came across the following expressions:
$$\begin{align} \widehat{S}_{2n} &:= \sum_{1 \leq k_1<\cdots<k_n \leq 2n} \prod_{\ell=1}^n (k_\ell-2\ell)^2, \\
\widehat{T}_{2n+1}&:=\sum_{1 \leq k_1 <\cdots <k_n \leq 2n} \prod_{\ell=1}^n (k_\ell-(2\ell+1))(k_\ell-2\ell) \end{align} $$
and I suspect that they equal the secant $S_{2n}$ and tangent $T_{2n+1}$ numbers , respectively. The secant and tangent numbers may be defined using Taylor series:
$$\begin{align} \sec x &= \sum_{n=0}^\infty \frac{S_{2n}}{(2n)!} x^{2n}, \\ \tan x &= \sum_{n=0}^\infty  \frac{T_{2n+1}}{(2n+1)!} x^{2n+1} .\end{align}  $$
I have verified that $\widehat{S}_{2n}= S_{2n}$ and that $\widehat{T}_{2n+1}=T_{2n+1}$ for $n \leq 10$, but I couldn't find a proof for the general case. I should also mention that the transformation $k_i \mapsto m_i+i$, which maps strictly increasing sequences to non-decreasing sequences produces the nicer-looking formulas:
$$\begin{align} \widehat{S}_{2n} &:= \sum_{0 \leq m_1 \leq \cdots \leq m_n \leq n} \prod_{\ell=1}^n (m_\ell-\ell)^2, \\
\widehat{T}_{2n+1}&:=\sum_{0 \leq m_1 \leq \cdots  \leq m_n \leq n} \prod_{\ell=1}^n (m_\ell-(\ell+1))(m_\ell-\ell). \end{align} $$
In search of a proof, I have tried generalizing this pattern. For example, the numbers
$$\widehat{S}^{(N)}_{2n}:= \sum_{0 \leq m_1 \leq \cdots \leq m_n \leq n} \prod_{\ell=1}^n (\ell-m_\ell)^N, $$
appear to be the Taylor coefficients of the function
$$f_N(x) = \frac{1}{1-\frac{1^N x}{1-\frac{2^N x}{1-\frac{3^N x}{1-\dots}}}}, $$
for any natural number $N$. That is, it seems that 
$$f_N(x) = \sum_{n=0}^\infty \widehat{S}^{(N)}_{2n} x^n. $$
That made me think that a proof could be obtained using a "continued-fraction-to-power-series" formula. Unfortunately, I do not know of such a formula.
I would appreciate help in confirming or denying the equalities $\widehat{S}_{2n}= S_{2n}$ and $\widehat{T}_{2n+1}=T_{2n+1}$ for all $n$. Also, a proof (or disproof) that $\widehat{S}^{(N)}_{2n}$ are indeed related to continued fractions as above would be great. Thanks!
 A: The paper Combinatorial aspects of continued fractions by P. Flajolet answers (affirmatively) all these questions. The following may help explain or simplify the arguments.
We treat a continued fraction like $f_N(x)$ as a formal power series, not as a function (because of convergence issues). That is, for a sequence $(a_1,a_2,a_3,\ldots)$ of, say, complex numbers, $$f(x)=\cfrac{1}{1-\cfrac{a_1 x}{1-\cfrac{a_2 x}{1-\cfrac{a_3 x}{\ldots}}}}:=\lim_{n\to\infty}\cfrac{1}{1-\cfrac{a_1 x}{1-\cfrac{\ldots}{1-\cfrac{a_n x}{1}}}}\tag{1}\label{cfracdef}$$ with $\big(1-g(x)\big)^{-1}:=\sum_{n=0}^{\infty}\big(g(x)\big)^n$ for $g(x)=\sum_{n=\color{red}{1}}^{\infty}g_n x^n$, and all limits understood in the conventional topology. In this setup, we have (see Corollary 2 in the paper) $$f(x)=1+\sum_{n=1}^{\infty}f_n x^n,\qquad f_n=\sum_{k_1=1}^{\color{gray}{0+}1}\sum_{k_2=1}^{k_1+1}\ldots\sum_{k_n=1}^{k_{n-1}+1}a_{k_1}a_{k_2}\ldots a_{k_n}.\tag{2}\label{cfpowers}$$ The paper gives it as a consequence of a more general treatment of continued fractions in a non-commutative setting (Theorem 1 there, with a "language-theoretic" proof that looks easy to read).
Put $k_{\ell}=\ell-m_{\ell}$ for $1\leqslant\ell\leqslant n$ here; then $f_n=\displaystyle\sum_{(m_1,\ldots,m_n)\in\mathscr{M}_n}\prod_{\ell=1}^{n}a_{\ell-m_{\ell}}$, where $$\mathscr{M}_n:=\left\{ (m_1,\ldots,m_n)\ \middle|\ \begin{array}{c}0\leqslant m_1\leqslant\ldots\leqslant m_n,\\ m_{\ell}\leqslant\ell-1\ (1\leqslant\ell\leqslant n)\end{array} \right\}.$$ Now if $\mathscr{N}_n:=\{ (m_1,\ldots,m_n) \mid 0\leqslant m_1\leqslant\ldots\leqslant m_n\leqslant n\}$, then $$\sum_{(m_1,\ldots,m_n)\in\mathscr{M}_n}\prod_{\ell=1}^{n}(\ell-m_{\ell})^N=\sum_{(m_1,\ldots,m_n)\in\mathscr{N}_n}\prod_{\ell=1}^{n}(\ell-m_{\ell})^N,$$ because each $(m_1,\ldots,m_n)\in\mathscr{N}_n\setminus\mathscr{M}_n$ has an $\ell$ with $m_{\ell}\geqslant\ell$ and hence with $m_{\ell}=\ell$.
This settles your question about the link between $\widehat{S}^{(N)}_{2n}\color{gray}{\text{ (why $2n$?)}}$ and $f_N$. The continued fractions for the secant and tangent numbers are also given in the paper (by Theorem 3B and Theorem 3A, respectively), but the combinatorial argument used is fairly hard to grasp. An alternative (attributed to Stieltjes) is to see that if the limit $f(x)$ in $\eqref{cfracdef}$ exists for any sufficiently small $x>0$, and if $f(x)$ admits an asymptotic power series in $x$, then this series is necessarily of the form $\eqref{cfpowers}$. Then, the secant numbers are found in the $s\to+\infty$ asymptotics of $$\cfrac{1}{1+\cfrac{1^2/s^2}{1+\cfrac{2^2/s^2}{1+\ldots}}}=2s\int_0^1\frac{x^s\,dx}{1+x^2}=s\int_0^\infty\frac{e^{-sx}\,dx}{\cosh x}$$ (using Watson's lemma), and similarly with the tangent numbers.
