On the number of prime divisors of a product of 4 consecutive integers In PEN (Problems in Elementary Number Theory) Project, there is a problem A111 as follows

Find $n$ if $n(n+1)(n+2)(n+3)$ has exactly three distinct prime divisors.

It's easy to see that at least 2, 3 should be two of the prime divisors of $n(n+1)(n+2)(n+3)$, and
I think there are infinitely many $n$ satisfying the above property, but I haven't found out the general answer.
Please help me.
Thanks.
 A: First not ethat $n=1$ is only almost a solution as $n(n+1)(n+2)(n+3)$ has only two prime divisors. Hence we ma assume $n>1$.
Let $p$ denote the third prime.
If $n$ is a multiple of $3$, then so is $n+3$. Then $n+1, n+2$ are divisible only by $2$ and $p$, and non of them is divisible by both. In other words, we have either
$$\tag1 n=3^a,\quad n+1=2^b,\quad n+2=p^c,\quad n+3=2^k3^d$$
or
$$\tag2 n=2^k3^a,\quad n+1=p^c,\quad n+2=2^b,\quad n+3=3^d.$$
Note that one of $a,d$ must be $=1$, and one of $b,k$ must be $=1$. This boils down to the following variants:

*

*$(1)$ with $a=1$, so $n=3$, $n+1=4$, $n+2=5$, $n+3=6$, which is indeed a solution

*$(1)$ with $b=1$ leads to $n=1$, so no.

*$(1)$ with $d=k=1$, so $n=3$ - see above

*$(2)$ with $d=1$ or $b=1$ leads to $n=0$, so no

*$(2)$ with $a=k=1$, so $n=6$, $n+1=7$, $n+2=8$, $n+3=9$, which is a solution.

Next, assume that $n$ is not a multiple of $3$. Then exactly one of the four numbers is a multiple of $2$, exactly two are multiples of $2$ and exactly one is a multiple of $p$. To cover four numbers this way, we must have that each of the for numbers is a prime power. In particular, the two powers of $2$ must be $2$ and $4$. This leaves us with $n=2$, $n+1=3$, $n+2=4$, $n+3=5$, which is a solution.
In summary, $n$ is a solution iff
$$ n\in\{2,3,6\}.$$
