Find number of five digit natural numbers using digits $1,2,3,4,5$ without Repetition such that consecutive digits do not appear together
I just tried in by listing the possibilities in a sequential manner:
The possibilities are:
$1)$ $13524$
$2)$ $14253$
$3)$ $24135$
$4)$ $24153$
$5)$ $25314$
$6)$ $31524$
$7)$ $35142$
$8)$ $41352$
$9)$ $42531$
$10)$ $42513$
$11)$ $52413$
$12)$ $53142$
So i got $12$ possibilities.
Is there a Mathematical or formal way to solve this and can we generalize it for $n$ digit numbers?
It's all in the following picture: $$\matrix{ &&3&&\cr &/&&\setminus &\cr &1\ &--&\ 5\cr &\setminus &&/&&\cr &\ 4&-&2\ &&\cr}$$ We can begin by $(31\ldots)$, $(13\ldots)$, $(14\ldots)$, $(41\ldots)$, and $(42\ldots)$. This will lead to $7$ strings, which then have to be multiplied by $2$ for the beginnings $(35\ldots)$, $(53\ldots)$, etcetera.