How many permutations of [n] are possible in which no even numbers and no odd numbers are adjacent?
Take  = 1 2 3 4 5. The ways to arrange the even numbers are 2 4 and 4 2 as long as stay in the even number slots. Then the way to arrange the odd numbers are 1 3 5; 1 5 3; 3 1 5; 3 5 1; 5 1 3; and 5 3 1. The number of permutations of  in which no even numbers and no odd numbers are adjacent is 2! * 3! or 2P2 times 3P3.
So I see the formula as two cases if n is even then it would be
If n is an odd number then
This seems too complicated.
Is there a way to calculate the total number of permutations n! and subtract the cases where the even numbers would be adjacent and the cases where the odd numbers would be adjacent?