Let $P(x)=(x-1)(x-2)(x-3)$. For how many [polynomials](https://artofproblemsolving.com/wiki/index.php/Polynomial) $Q(x)$ does there exist a polynomial $R(x)$ of degree 3 such that $P(Q(x))=P(x) \cdot R(x)$?

$\mathrm {(A) } 19 \qquad \mathrm {(B) } 22 \qquad \mathrm {(C) } 24 \qquad \mathrm {(D) } 27 \qquad \mathrm {(E) } 32$
We can write the problem as


$P(Q(x))=(Q(x)-1)(Q(x)-2)(Q(x)-3)=P(x)\cdot R(x)=(x-1)(x-2)(x-3)\cdot R(x)$.



Since $\deg P(x) = 3$ and $\deg R(x) = 3$, $\deg P(x)\cdot R(x) = 6$. Thus, $\deg P(Q(x)) = 6$, so $\deg Q(x) = 2$.


$P(Q(1))=(Q(1)-1)(Q(1)-2)(Q(1)-3)=P(1)\cdot R(1)=0,$$P(Q(2))=(Q(2)-1)(Q(2)-2)(Q(2)-3)=P(2)\cdot R(2)=0,$$P(Q(3))=(Q(3)-1)(Q(3)-2)(Q(3)-3)=P(3)\cdot R(3)=0.$


Hence, we conclude $Q(1)$, $Q(2)$, and $Q(3)$ must each be $1$, $2$, or $3$. Since a [quadratic](https://artofproblemsolving.com/wiki/index.php/Quadratic_equation) is uniquely determined by three points, there can be $3*3*3 = 27$ different quadratics $Q(x)$ after each of the values of $Q(1)$, $Q(2)$, and $Q(3)$ are chosen.

However, we have included $Q(x)$ which are not quadratics: lines. Namely,


$Q(1)=Q(2)=Q(3)=1 \Rightarrow Q(x)=1,$$Q(1)=Q(2)=Q(3)=2 \Rightarrow Q(x)=2,$$Q(1)=Q(2)=Q(3)=3 \Rightarrow Q(x)=3,$$Q(1)=1, Q(2)=2, Q(3)=3 \Rightarrow Q(x)=x,$$Q(1)=3, Q(2)=2, Q(3)=1 \Rightarrow Q(x)=4-x.$


Clearly, we could not have included any other constant functions. For any linear function, we have $2\cdot Q(2) = Q(1) + Q(3)$ because $Q(2)$ is y-value of the midpoint of $(1, Q(1))$ and $(3, Q(3))$. So we have not included any other linear functions. Therefore, the desired answer is $27 - 5 = \boxed{\textbf{(B) }22}$.