An **alternating permutation** is an arrangement of a set of numbers; specifically, the numbers are arranged so that the value of any particular number is not in the range of the values on either side of it. Mathematically:

Let `A={c1,c2,...,cn}` be an alternating permutation of the numbers `c1,c2,...,cn`. Then neither `c(i-1)<c(i)<c(i+1)` nor `c(i-1)>c(i)>c(i+1)` for all naturals i.

So suppose `A={1,2,3,4,5}`. An alternating permutation of A is the set `{1,5,2,4,3}` (5 is not between 1 and 2, 2 is not between 5 and 4, and 4 is not between 2 and 3 in terms of the number value).

The number of alternating permutations for a specific number of naturals is called an Euler zigzag number (just how many different Euler numbers are there?) and is denoted A(n) (or A_{n}). The first several values of A(n) are as follows:

n A(n)
0 1
1 1
2 1
3 2
4 5
5 16
6 61
7 272
.
.
.

An interesting property of the zigzag numbers (leading to the actual zig and zag distinctions) is the following trigonometric equation involving a Maclaurin series:

∞
-----
\ / n \
sec(x)+tan(x) = > A | x |
/ n| ------ |
----- \ n! /
n=1

(Here the even-numbered terms [A(0), A(2), etc.] are associated with the secant, while the odd-numbered ones are associated with the tangent, see zig number and zag number respectively.)

*Major source: *__http://mathworld.wolfram.com/AlternatingPermutation.html__.