six digit integers with each digit relatively prime to next Six-digit integers will be written using each of the digits
1 through 6 exactly once per six-digit integer. How many different positive integers can be written such that all pairs of consecutive digits of each integer are relatively prime? (Note: 1 is relatively prime to all integers.)
There seem to be lots of cases involved and I can't find a consistent criteria. Would appreciate any help. Thanks! 
 A: The bulk of the conditions simply states that two even digits can’t be adjacent. The only other condition is that $3$ mustn't be next to $6$. So we can count the strings without adjacent even digits and then subtract the ones that have $3$ and $6$ adjacent.
We must either have alternating even and odd digits, or two even digits at the ends and the third one next to the centre. There are $2$ different alternating patterns and $2$ different positions next to the centre, so that’s a total of $4$ parity arrangements. Each can be filled with digits in $(3!)^2=36$ ways, so that makes $4\cdot36=144$ strings without adjacent even digits.
The alternating patterns have $5$ different pairs of adjacent even and odd digits, whereas the ones with even digits at the ends have only $4$. The $3$ and $6$ can be adjacent in any of these pairs, and the remaining digits can be filled in $(2!)^2=4$ different ways, for a total of $(2\cdot5+2\cdot4)\cdot4=72$ strings that have $3$ and $6$ adjacent.
Thus there are $144-72=72$ strings in which all adjacent digits are coprime.
