Find all postive integers $n$ such $(2n+7)\mid (n!-1)$ 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. 
 A: 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.
A: Here is a partial answer.
If $d \; | \; 2n + 7$ and $1 < d \leq n$, then $d \; | \; n!-1$ and $d \; | \; n!$, hence $d \; | \; n! - (n!-1) = 1$. This means there are no solutions when there is a $d$ such that $d \;|\; 2n+7$ and $1 < d\leq n$.
Now suppose that $(2n+7)=ab$ is composite with $a,b>1$. By the first step, this means $a,b>n$ or that $2n+7 > n^2$ or $n<4$. 
Both of the above paragraphs mean that $(2n+7)=n!-1$ only has a solution when $n \geq 4$ when $2n+7$ is prime.
I ran a quick computer search on primes $p=2n+7$ up to the 10,000th prime and only obtained solutions $n=1,5,8$. 
This is related to factorial primes. That is, primes of the form $n!-1$. According to wikipedia it is an open question whether or not there are an infinite number of these. Though all that's needed here is a lower bound on the growth rate of such $n$. Looking at the OEIS entry you can see the growth of the sequence is almost exponential which would put it out of reach of $2n+7$ ever reaching $n!-1$ in the case of it being prime. This suggests there are no other solutions.
