TITLE: Find all postive integers $n$ such $(2n+7)\mid (n!-1)$
QUESTION [7 upvotes]: Find all postive integers $n$ such that
$$(2n+7)\mid(n!-1).$$
I have $n=1,5$, but can not find any other and can not prove whether there is any other solution or not.

REPLY [2 votes]: Building on nayrb's observation that $2n+7$ must be prime (for $n\ge 4$), let $p = 2n+7$.  Then by assumption, $n! \equiv 1 \pmod p$.  Symmetrically, we also have $$(2n+6)(2n+5)\cdots(n+7) \equiv (-1)(-2)\cdots(-n) \equiv (-1)^n n! \equiv \pm 1 \pmod p.$$
Now combine this with Wilson's theorem that $(2n+6)! \equiv -1 \pmod p$, and we have
$$(n+1)(n+2)(n+3)(n+4)(n+5)(n+6) \equiv \pm 1 \pmod p.$$
Multiply both sides by $2^6$ and this becomes
$$(2n+2)(2n+4)(2n+6)(2n+8)(2n+10)(2n+12) = \pm 64 \pmod p,$$
which simplifies to
$$(p-5)(p-3)(p-1)(p+1)(p+3)(p+5) \equiv -225 \equiv \pm 64 \pmod p,$$
so necessarily $p \mid 225\pm 64$, that is either $p \mid 289 = 17^2$ or $p \mid 161 = 7\cdot 23$.
This proves that the number of solutions is finite.  I leave it to you to identify the actual solutions.