Task 3. Determine the product of all positive integers $n$ for which $3(n !+1)$ is divisible by $2 n-5$.

---

Translate the above text into English, please retain the original text's line breaks and format, and output the translation result directly.
Solution. The numbers $n=1$ to $n=4$ satisfy, because $2n-5$ is then equal to $-3, -1, 1$, and $3$, respectively, so always a divisor of $3(n!+1)$. From now on, we only consider $n>4$ and then $2n-5>3$.

We first prove that if $n$ satisfies, then $2n-5$ must be prime. We distinguish two cases. Suppose first that $2n-5$ is not prime and has a prime divisor $p>3$. Since $p \neq 2n-5$ and since $2n-5$ is odd, it follows that $p \leq \frac{2n-5}{3}$. Since $n>4$, $3 \nmid n!+1$, so $3(n!+1)$ is divisible by exactly one factor of 3 and no more. We see that $n$ cannot satisfy in this case either.

For an $n>4$ that satisfies, we now know that $2n-5$ is a prime number greater than 3. Write $q=2n-5$. Then $q \mid n!+1$, or $n! \equiv -1 \pmod{q}$. Furthermore, Wilson's theorem states that $(q-1)! \equiv -1 \pmod{q}$. Therefore,

\[
\begin{aligned}
-1 & \equiv (2n-6)! \\
& \equiv (2n-6)(2n-7) \cdots (n+1) \cdot n! \\
& \equiv (-1) \cdot (-2) \cdots (-n+6) \cdot n! \\
& \equiv (-1)^{n-6} \cdot (n-6)! \cdot n! \\
& \equiv (-1)^{n} \cdot (n-6)! \cdot -1 \pmod{q}.
\end{aligned}
\]

Thus, $(n-6)! \equiv (-1)^{n} \pmod{q}$. Since $n! \equiv -1 \pmod{q}$, it follows that $n \cdot (n-1) \cdots (n-5) \equiv (-1)^{n-1} \pmod{q}$. We multiply this by $2^6$:

\[
2n \cdot (2n-2) \cdot (2n-4) \cdot (2n-6) \cdot (2n-8) \cdot (2n-10) \equiv (-1)^{n-1} \cdot 64 \pmod{q}
\]

Modulo $q=2n-5$, the left side is $5 \cdot 3 \cdot 1 \cdot -1 \cdot -3 \cdot -5 = -225$.

Suppose $n$ is odd. Then we have $-225 \equiv 64 \pmod{q}$, so $q \mid -225-64 = -289 = -17^2$. Thus, $q=17$ and then $n=\frac{17+5}{2}=11$. Suppose now $n$ is even. Then we have $-225 \equiv -64 \pmod{q}$, so $q \mid -225+64 = -161 = -7 \cdot 23$. Thus, $q=7$ or $q=23$, which gives $n=6$ and $n=14$, respectively.

We check these three possibilities. For $n=11$ and $2n-5=17$:

\[
\begin{aligned}
11! & = 1 \cdot (2 \cdot 9) \cdot (3 \cdot 6) \cdot (5 \cdot 7) \cdot 4 \cdot 8 \cdot 10 \cdot 11 \\
& \equiv 4 \cdot 8 \cdot 10 \cdot 11 = 88 \cdot 40 \equiv 3 \cdot 6 \equiv 1 \pmod{17}
\end{aligned}
\]

so $n=11$ does not satisfy. For $n=14$ and $2n-5=23$:

\[
\begin{aligned}
14! & = 1 \cdot (2 \cdot 12) \cdot (3 \cdot 8) \cdot (4 \cdot 6) \cdot (5 \cdot 14) \cdot (7 \cdot 10) \cdot 9 \cdot 11 \cdot 13 \\
& \equiv 9 \cdot 11 \cdot 13 = 117 \cdot 11 \equiv 2 \cdot 11 \equiv -1 \pmod{23},
\end{aligned}
\]

so $n=14$ satisfies. For $n=6$ and $2n-5=7$ finally, $6! \equiv -1 \pmod{7}$ follows from Wilson's theorem, so $n=6$ also satisfies.

We conclude that the numbers $n$ that satisfy are: $1, 2, 3, 4, 6$, and $14$. The product of these is 2016.