# Finding Required Permutation

I have numbers from $1$..$n$. I want to find number of permutation from all $n!$ permutation where the numbers have following arrangement.

$L$ $G$ $L$ $G$ $L$ or $G$ $L$ $G$ $L$ $G$.

Where L means that the number is less than $G$.

for ex if $n$=$4$ than I want to find following permutation

$1 3 2 4$

$2 3 1 4$

$2 1 4 3$

$1 4 2 3$

$2 4 1 3$

$4 1 3 2$

$3 1 4 2$

$3 4 1 2$

$4 2 3 1$

$3 2 4 1$

Here number of such permutation is $10$. I want to generalize it for any $n$.

• "Where L means that the number is less than G." Fine, but what does $G$ mean? I cannot figure out what you are asking. Feb 23, 2014 at 8:16
• it means the number can either be ni-1<ni>ni+1 or ni-1>ni<ni+1 Feb 23, 2014 at 8:23
• So, each number is either bigger than both its neighbors, or smaller than both its neighbors? Feb 23, 2014 at 8:24
• yes, thats correct. Feb 23, 2014 at 8:29
• Evidently not, since you want $(32451)$. Feb 23, 2014 at 8:35

• True, but the numbers on either side of $4$, one of them is bigger than $4$, and the other is less than $4$. So I still don't understand what permutations you want. Feb 23, 2014 at 8:35