TITLE: Solve for $n$, with factorial.
QUESTION [5 upvotes]: If $\sqrt{n! + 23}$ is an integer, then $n=$?
I started: $k \in \mathbb{N}$ and:
$$k = \sqrt{n! + 23}$$
It follows, $n! = k^2 - 23$
$\Gamma(n+1) = k^2 - 23$ but that doesnt help?

REPLY [8 votes]: For $n\geq4$ we have that $n!+23$ leaves remainder $3$ mod $4$. But squares of integers can only leave remainder $0$ or $1$ mod $4$.
Therefore we only need to check $n=1,2,3$. 
We get that only $n=2$ gives $$\sqrt{2!+23}=\sqrt{25}=5.$$

REPLY [3 votes]: If $n\geq 46$, then $23$ divides $n!+23$ but $23^2$ does not divide $n!+23$, hence $n!+23$ is not a square. This gives that we have only a finite number of cases to check.

REPLY [3 votes]: We are looking for $n$ such that $n!+23$ is square. For $n\geq 5$ the last digit of $n!$ is $0$ or in modular arithmetic $n!\equiv 0\pmod{10}$. Therefore $n!+23\equiv 3 \pmod{10}$. Therefore it cannot be a square because a square $\pmod{10}$ can only be $\{1,4,9,6,5\}$. Remains to check the cases $\lt 5$ and only $n=2$ works¤