TITLE: Prove $n! +5$ is not a perfect square for $n\in\mathbb{N}$
QUESTION [11 upvotes]: I have a proof of this simple problem, but I feel that the last step is rather clunky:
For $n=1,2,3,4$ we have $n!+5=6,7,11,29$ respectively, none of which are square. Now assume that $n\geq 5$, then:
$$\begin{aligned}
n! +5 & \;=\; n(n-1)\cdots 6\cdot 5 \cdot 4 \cdot 3 \cdot 2 \cdot 1 + 5 \\[0.2cm]
& \;=\; 5\left[ \frac{}{} n(n-1)\cdots 6\cdot 4 \cdot 3 \cdot 2 \cdot 1 + 1 \right] \\[0.2cm]
&\;=\; 5(3k+1) 
\end{aligned}$$
for some $k\in\mathbb{N}$. Since $5(3k+1)=15k+5\equiv 5\,\text{mod} \, 15$ and all perfect squares are congruent either $0,1,4,6, 9$ or $10\,\text{mod}\,15$, the result follows.  $\;\blacksquare$
It took a pretty tedious exhaustive search of squares modulo 15 in the last step; is there a theorem I am missing that means the last step follows immediately? Your comments are much appreciated!

REPLY [3 votes]: If $n! + p = k^2$ for some prime it's not too difficult to conclude $n < p$ and $k$ has no prime factors less than $p$, or $p \le n < 2p$, $\frac {n!}p + 1$ is divisible by $p$ and $\frac {\frac {n!}p + 1}p$ is a perfect square to no prime factors less than $p$[$*$].
We can go a bit further.  $(p-1)! \equiv -1 \mod p$ by Wilson's Theorem so for $p \le n < 2p$ with $\frac {n!}p + 1\equiv 0 \mod p$ we can conclude $\frac {n!}p = (p-1)!\prod (p + k) \equiv -1 \mod p$ so $(n-p)! \equiv 1 \mod p$.  And $n = p+1$ or $n = p + (p-2)= 2p-2$ so only two cases to check, if $n \ge p$.
So if $n < 5$ and $n! + 5 = k^2$ then $n! + 5 \ge 7^2$ which is simply not possible for $n\le 4; n! \le 24$
If $5\le n < 10$. then  $\frac {n!}5 \equiv -1 \mod 5$. If $n = 5+k$ then $\frac {n!}5 = 4!*(6....n) \equiv 4!*k! \equiv -k! \equiv -1$ so $k! \equiv 1\mod 5$.  So $k =1, 3$ and $n=6,8$. Which can be checked.
Which is probably much more clunky than your proof.  But it could be useful for generalizing.
====
[$*$] $k \le n$ implies $k|n!$ so $k\not \mid n! +p$ unless $k = p$.  If so $p|n! + p$ and $n! + p = p(\frac {n!}p + 1)$.  If $n \ge 2p$ then $p|\frac {n!}p$ and $p \not \mid \frac{n!}p + 1$.  If $n! + p$ is a perfect square and $p|n! + p$ then $p^2|n!+p$ and so $p \le n < 2p$.