# Local Maximas of various Permutations!

**Discrete Mathematics**Level 5

A permutation \(\pi\) of \(\{1,2,\ldots,n\}\) (with \(n \geq 3\)) has a local maximum at a position \(k\) if the two neighbouring numbers (or, in case \(k=1\) or \( k=n\), the one neighbouring number) are both smaller than the number in position \(k\).

**For Example**: If \(n=5\), then the permutation \(\{2,1,4,5,3 \}\) has local maxima(s) in position(s) 1 and 4 (the numbers 2 and 5 respectively).

What is the average number of local maxima of a permutation of \(\{1,2,\ldots, n\}\), averaging over all such permutations for \(n=2015\) ?

**Bonus** - Generalize the above problem for \(n\).