Alternating permutation

In combinatorial mathematics, an alternating permutation (or zigzag permutation) of the set {1, 2, 3, ..., "n"} is a permutation (arrangement) of those numbers so that each entry is alternately greater or less than the preceding entry. For example, the five alternating permutations of {1, 2, 3, 4} are:
This type of permutation was first studied by Désiré André in the 19th century.
Different authors use the term alternating permutation slightly differently: some require that the second entry in an alternating permutation should be larger than the first (as in the examples above), others require that the alternation should be reversed (so that the second entry is smaller than the first, then the third larger than the second, and so on), while others call both types by the name alternating permutation.
The determination of the number "A""n" of alternating permutations of the set {1, ..., "n"} is called André's problem. The numbers "A""n" are known as Euler numbers, zigzag numbers, or up/down numbers. When "n" is even the number "A""n" is known as a secant number, while if "n" is odd it is known as a tangent number. These latter names come from the study of the generating function for the sequence.
Definitions.
A permutation is said to be "alternating" if its entries alternately rise and descend. Thus, each entry other than the first and the last should be either larger or smaller than both of its neighbors. Some authors use the term alternating to refer only to the "up-down" permutations for which , calling the "down-up" permutations that satisfy by the name "reverse alternating". Other authors reverse this convention, or use the word "alternating" to refer to both up-down and down-up permutations.
There is a simple one-to-one correspondence between the down-up and up-down permutations: replacing each entry with reverses the relative order of the entries.
By convention, in any naming scheme the unique permutations of length 0 (the permutation of the empty set) and 1 (the permutation consisting of a single entry 1) are taken to be alternating.
André's theorem.
The determination of the number "A""n" of alternating permutations of the set {1, ..., "n"} is called "André's problem". The numbers "A""n" are variously known as "Euler numbers", "zigzag numbers", "up/down numbers", or by some combinations of these names. The name Euler numbers in particular is sometimes used for a closely related sequence. The first few values of "A""n" are 1, 1, 1, 2, 5, 16, 61, 272, 1385, 7936, 50521, ... .
These numbers satisfy a simple recurrence, similar to that of the Catalan numbers: by splitting the set of alternating permutations (both down-up and up-down) of the set { 1, 2, 3, ..., "n", "n" + 1 } according to the position "k" of the largest entry , one can show that
for all . used this recurrence to give a differential equation satisfied by the exponential generating function
for the sequence . In fact, the recurrence gives:
where we substitute formula_4 and formula_5. This gives the integral equation
which after differentiation becomes formula_7.
This differential equation can be solved by separation of variables (using the initial condition formula_8), and simplified using a tangent half-angle formula, giving the final result
the sum of the secant and tangent functions. This result is known as "André's theorem".
It follows from André's theorem that the radius of convergence of the series is /2. This allows one to compute the asymptotic expansion
Related integer sequences.
The odd-indexed zigzag numbers (i.e., the tangent numbers) are closely related to Bernoulli numbers. The relation is given by the formula
for "n" > 0.
If "Z""n" denotes the number of permutations of {1, ..., "n"} that are either up-down or down-up (or both, for "n" < 2) then it follows from the pairing given above that "Z""n" = 2"A""n" for "n" ≥ 2. The first few values of "Z""n" are 1, 1, 2, 4, 10, 32, 122, 544, 2770, 15872, 101042, ... .
The Euler zigzag numbers are related to Entringer numbers, from which the zigzag numbers may be computed. The Entringer numbers can be defined recursively as follows:
The "n"th zigzag number is equal to the Entringer number "E"("n", "n").
The numbers "A"2"n" with even indices are called secant numbers or zig numbers: since the secant function is even and tangent is odd, it follows from André's theorem above that they are the numerators in the Maclaurin series of . The first few values are 1, 1, 5, 61, 1385, 50521, ... .
Secant numbers are related to the signed Euler numbers (Taylor coefficients of hyperbolic secant) by the formula "E"2"n" = (−1)"n""A"2"n". ("E""n" = 0 when "n" is odd.)
Correspondingly, the numbers "A"2"n"+1 with odd indices are called tangent numbers or zag numbers. The first few values are 1, 2, 16, 272, 7936, ... .
Explicit formula in terms of Stirling numbers of the second kind.
The relationships of Euler zigzag numbers with the Euler numbers, and the Bernoulli numbers can be used to prove the following
where 
formula_17 denotes the rising factorial, and formula_18 denotes Stirling numbers of the second kind.