Combinatorics: $\sigma(i)\ne i,i+1$

45 Views Asked by At

I need to find the number of permutations $\sigma$ on $[n]={0,...,n-1}$ such that $\sigma(i)\ne i$ and $\sigma(i)\ne i+1 \mod{n}$. I know that the first condition counts the number of derangements and the second condition, if considered on its own, would have just as many permutations. If we call the property $\phi$ the derangement property, $\sigma(i)\ne i$ and if we call the property $\psi$ the property $\sigma(i)\ne i+1 \mod{n}$, then I want to count all permutations with property $\phi\land \psi$. Let's denote this with $\#(\phi\land \psi)$ and assume we know the number of derangements, i.e. we know how to count $\#\phi$ and we have $\#\phi=\#\psi$. Then

$$\#(\phi\land\psi) = n!-\#(\overline{\phi}\lor\overline{\psi})$$

and

$$\#(\phi\lor\psi)=\#\phi+\#\psi-\#(\phi\land\psi)$$

but I didn't find any way of combining these or calculating $\#(\phi\lor\psi)$ or $\#(\overline{\phi}\lor\overline{\psi})$.

I also thought of trying to do find a recursive formula, $a_n$ in terms of earlier terms of the sequence. If we assume $1\mapsto i\ne 1,2$, we know there are $n-2$ ways to do this. But I don't see a good way to reduce the problem to smaller sub-problems. If $i\mapsto 1$ then the remaining $n-2$ elements cannot be mapped in $a_{n-2}$ ways because $i-1$ and $n$ have fewer constraints than the other elements. We could then consider whether $i-1\mapsto 2$ or $n$ or something else, and whether $n\mapsto 2$ or $i$ or something else, but this seems too messy and might not work.

I also can't see how to use the inclusion-exclusion principle since, if I try to count the ways for two elements to violate the property, it will differ based on whether the two elements are chosen adjacent or not. So again, the calculations seem messy or intractable, but at this point I'm out of ideas.