Prove $n! +5$ is not a perfect square for $n\in\mathbb{N}$
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!
Solution 1:
When $n\geq 3$ $$n!+5 \equiv 2 \pmod{3}$$ So it cannot be a perfect square when $n\geq 3$.
Solution 2:
As you can see from pisco125's brilliant answer, the step in which you deduce $n! + 5 = 15k + 5$ for $n \geq 5$ is in this case unnecessary.
With factorials you can usually rely on the fact that $d \mid n!$ for all $n \geq d$. This means $n!$ is divisible by 5 for all $n \geq 5$. Then, although 25 is a bigger modulo than 3 or 15, it's very convenient here, because if $m \equiv 5 \pmod{10}$, then $m^2 \equiv 0 \pmod{25}$. That is to say, 5 is not a square modulo 25. Of course this way you still have to check $n < 10$, whereas pisco's way you need only check $n < 3$.