How many ways can all six numbers in the set $\{4, 3, 2, 12, 1, 6\}$ be ordered Is there an easy way to solve the problem?

How many ways can all six numbers in the set $S = \{4, 3, 2, 12, 1, 6\}$ be ordered so
  that $a$ comes before $b$ whenever $a$ is a divisor of $b$?

By analyzing each number in $S$, I get the answer, but I don't like the way I solved the problem.
$$1, 2, 3, 4, 6, 12$$ $$1, 2, 3, 6, 4, 12$$ $$1, 2, 4, 3, 6, 12$$ $$1, 3, 2, 4, 6, 12$$ $$1, 3, 2, 6, 4, 12$$
 A: I would solve this problem by looking at the divisor lattice for $12$ and then doing casework. Here is the divisor lattice:

You're asking us to put any number that is below another on a tree before in the list. Therefore, $1$ is the first number since it's at the bottom. The next number is either $2$ or $3$, since those are the only nodes connected to $1$.


*

*After $1,2$, then we have access to $4$, but we could also go with $3$.

*
*

*After $1,2,3$, then we have access to $6$, but we could also go with $4$. If we go with $4$, we get $1,2,3,4,6,12$ and if we go with $6$, we get $1,2,3,6,4,12$.


*
*

*After $1,2,4$, we have to go with $3$, then $6$, then $12$, so $1,2,4,3,6,12$.


*After $1,3$, we have to go with $2$, but then we can go with either $4$ or $6$.

*
*

*After $1,3,2,4$, we must choose $6$ then $12$, so $1,3,2,4,6,12$.


*
*

*After $1,3,2,6$, we must choose $4$ then $12$, so $1,3,2,6,4,12$.



Thus, through this casework, we get the same $5$ solutions you did, but we went through all possible cases, so we can be sure there are no more.
A: Using graph is easier. In all possibilities, 1 is always the first, and 12 is always the last. There are 5 ways to connect all the numbers from 1 to 12 as shown in the graph. You are unlikely to make a mistake or miss a line if you solve the problem this way.

