TITLE: Infinitely many positive integers $n$ such that $n^2+1 \mid 1 \cdot 2 \cdot 5 \cdot 10 \cdots ((n-1)^2+1)$
QUESTION [11 upvotes]: Prove that there exist infinitely many positive integers $n$ such that $$n^2+1 \mid 1 \cdot 2 \cdot 5 \cdot 10 \cdots ((n-1)^2+1).$$

We need to prove that there are infinitely many $n$ such that $\prod_{m=0}^{n-1}(m^2+1)$ is divisible by $n^2+1$. Some examples I found for when it is divisible are $n = 3,7,8,13,17,18,21$, but I didn't see how to find infinitely many.

REPLY [5 votes]: Since $(m-i)(m-1+i)=\left(m^2-m+1\right)+i$, multiplying both sides by their conjugates gives
$$
(m^2-m+1)^2+1=\left(m^2+1\right)\left((m-1)^2+1\right)\tag{1}
$$
For $m\ge2$, we have that $n=m^2-m+1\gt m$. Therefore, $(1)$ shows that
$$
\left.n^2+1\,\,\middle|\,\,\prod_{k=0}^{n-1}\left(k^2+1\right)\right.\tag{2}
$$