Define a permutation $(a_1,a_2,\dots,a_{30})$ of $\{1,2,\ldots,30\}$ as good if for all $m \in \{2,3,5\}$, we have that $m$ divides $a_{n+m}-a_n$ for all integers $n$ satisfying $1 \leq n < n+m \leq 30$. How many good permutations are there?
I don't understand how to formulate the binomial expressions and casework. Could someone provide me with a solution? Thank you.