There are $N$ permutations $(a_1, a_2, \dots, a_{42})$ of $1, 2, \dots, 42$ such that for $m \in \{2,3,7\}$, $m$ divides $a_{n+m} - a_n$ for all integers $n$ with $1 \le n < n+m \le 42$. Find the remainder when $N$ is divided by 1000.
← Back to Problem 404