how to prove this:
$$ \text{if } n! + n^2 + 1 \text{ is prime then } n^2 + 1 \text { is also prime}$$
I was thinking that n! is definitely not prime since it can be written as $n\times (n-1)....2\times 1$. So $n^2 + 1$ is not prime. In other words, n! does not have the same factor as $n^2 + 1$, and I don't know how to prove the following.
Suppose $n^2+1=uv$ is composite ($u,v$ proper factors).
As $n^2+1$ is not a square (being between $n^2$ and $(n+1)^2=n^2+2n+1$), we have $u\ne v$, and without loss of generality assume $u\lt v$. Then $u\le n$ and, because $u\mid n^2+1$ and $u\mid n!$, we have $u\mid n!+n^2+1$ so $n!+n^2+1$ cannot be prime.