The sequence of positive integers $a_{0}, a_{1}, a_{2}, \ldots$ is defined by $a_{0}=3$ and

$$
a_{n+1}-a_{n}=n\left(a_{n}-1\right)
$$

for all $n \geq 0$. Determine all integers $m \geq 2$ for which $\operatorname{gcd}\left(m, a_{n}\right)=1$ for all $n \geq 0$.
A direct formula for the sequence is given by $a_{n}=2 \cdot n!+1$ for $n \geq 0$. (We use the common definition $0!=1$, which satisfies $1!=1 \cdot 0!$, and for larger $n$ it holds that $n!=n \cdot(n-1)!$.) We prove the direct formula by induction. It holds that $a_{0}=3$ and that is equal to $2 \cdot 0!+1$. Suppose now that for some $k \geq 0$ it holds that $a_{k}=2 \cdot k!+1$, then

$$
a_{k+1}=a_{k}+k \left(a_{k}-1\right)=2 \cdot k!+1+k \cdot 2 \cdot k!=2 \cdot k! \cdot (1+k)+1=2 \cdot (k+1)!+1
$$

This completes the induction.

We see that $a_{n}$ is always odd, so $\operatorname{gcd}\left(2, a_{n}\right)=1$ for all $n$. It follows that $\operatorname{gcd}\left(2^{i}, a_{n}\right)=1$ for all $i \geq 1$. Therefore, $m=2^{i}$ with $i \geq 1$ satisfies. Now take an $m \geq 2$ that is not a power of two. Then $m$ has an odd prime divisor, say $p$. We show that $p$ is a divisor of $a_{p-3}$. By Wilson's theorem, it holds that $(p-1)!\equiv-1 \bmod p$. Thus,
$2 \cdot(p-3)!\equiv 2 \cdot(p-1)!\cdot((p-2)(p-1))^{-1} \equiv 2 \cdot-1 \cdot(-2 \cdot-1)^{-1} \equiv 2 \cdot-1 \cdot 2^{-1} \equiv-1 \quad \bmod p$.
Therefore, indeed $a_{p-3}=2 \cdot(p-3)!+1 \equiv 0 \bmod p$. We conclude that $m$ does not satisfy. Therefore, the only values of $m$ that satisfy are the powers of two.