TITLE: Number of Ways of Ordering Numbers
QUESTION [5 upvotes]: How many ways you can order the numbers $0, 1, 2, 3,..., 12$ using each number exactly once, such that the sum of two adjacent numbers are not greater than $13$? (This is a first round's question of the four rounds of Bangladesh Mathematical Olympiad for class $11$–$12$.)
For example, these are some orderings which satisfy the condition:

$0, 12, 1, 11, 2, 10, 3, 9, 4, 8, 5, 7, 6$
$12, 1, 11, 2, 10, 3, 9, 4, 8, 5, 7, 6, 0$
$1, 12, 0, 11, 2, 10, 3, 9, 4, 8, 5, 6, 7$
$11, 2, 10, 1, 12, 0, 3, 9, 4, 8, 5, 6, 7$
$6, 7, 2, 11, 0, 12, 1, 10, 3, 5, 8, 4, 9$

REPLY [5 votes]: Denote the number by $P(12)$.
There are six different arrangements for the placing of the $12$. It can be at one end and adjacent to $0$ or $1$ or it can be adjacent to both $0$ and $1$ in some order.
Consider a line starting $12,0$. The number of possibilities is then the number of arrangements of $1$ to $11$ with sum not greater than $13$ but (subtracting $1$ from each number) this is the same as $P(10)$.
The line starting $12,1$ is the same since neither $0$ nor $1$ add to greater than $13$ with a remaining number.
In the case of $0,12,1$ occurring in a line, replace this sequence by $1$ and then we again require the number of arrangements of $1$ to $11$ with sum not greater than $13$.
Thus $P(12)=6P(10)=36P(8)= ... =6^5.$