Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I prove that

If $n$ is a positive integer such that $$n>8$$ then $$\frac{n!-1}{2n+7}$$ is never an integer? Some of the first things that came to my mind is that $n!-1$ is not divisible by all numbers from $2$ to $n$, so if $$2n+7<n^2$$ That is, $n>3$

then $2n+7$ must be a prime number in order to actually get an integer.

But thats all i have got until now, after checking some basic number theory theorems, I even tried linking it to Wilson´s theorem, unsuccesfully. Any hint or idea will be very appreciated

share|cite|improve this question
up vote 10 down vote accepted

As you observed, unless $2n+7$ is prime, you get $2n+7|n!$. This is clear, since if $2n+7$ is not prime, you can write it as $2n+7=ab$ and since neither $a$ nor $b$ are 2, both must be less than $n$. As Jonas pointed, if $a \neq b$ the conclusion is immediate, while if $a=b$ we have $a^2=2n+7$ and one can easily conclude that $2a \leq n$.

So lets cover the case $p=2n+7$ is prime. Then $n=\frac{p-7}{2}=\frac{p-1}{2}-3$.

Then you get

$$n! \equiv 1 \pmod p$$


$$(\frac{p-1}{2}-3)! \equiv 1 \pmod p \,.$$ $$(\frac{p-1}{2})! \equiv \frac{p-5}{2}\frac{p-3}{2}\frac{p-1}{2} \equiv 8^{-1}(-15) \pmod p \,.$$

Square both sides:

$$[(\frac{p-1}{2})!]^2 \equiv 64^{-1}(15)^2 \pmod p \,.$$

The LHS is exactly $(p-1)! (-1)^{\frac{p-1}{2}}$. Thus

$$(-1)^{\frac{p+1}{2}} \equiv 64^{-1}(15)^2 \pmod p \,,$$


$$\pm 64 \equiv 225 \pmod p$$

This means that $p$ is a divisor of $225 \pm 64$. Note that $p=2n+7>23$.

This reduces the problem to few cases to check.

share|cite|improve this answer
@Jonah good point. The case $a=b$ is trivial though. – N. S. Jun 7 '13 at 4:02

Hint: $\ $ Supposing that $\ p = 2n\!+\!7\ $ is prime and $\,\color{#0a0}{p\mid n! - 1},\,$ and applying Wilson's Theorem

$\begin{eqnarray} {\rm mod}\ \ p\!:\ {-}1 \equiv (p\!-\!1)! &\equiv&\, (2n\!+\!6)\!&&\!(2n\!+\!5)\!\!&&\cdots (n\!+\!7) &&(n\!+\!6)\cdots (n\!+\!1)\, n!\\ &\equiv& \ \ \ (-1)&&\ \ (-2)&&\cdots\ \, (-n)&&(n\!+\!6)\cdots (n\!+\!1)\, n! \\ &\equiv& && && \quad\ \ \ (-1)^n &&(n\!+\!6)\cdots (n\!+\!1)\ \ \ \ {\rm by}\ \ \ \color{#0a0}{n!\equiv 1} \end{eqnarray}$ $\begin{eqnarray}\ \stackrel{\large \times\ 2^6}\Rightarrow\ \pm 2^6 &\equiv&\, (\color{#c00}{2n}\!+\!12)(\color{#c00}{2n}\!+\!10)\cdots (\color{#c00}{2n}\!+\!2)\\ &\equiv&\, (5)\,(3)\,(1)\,(-1)\,(-3)\,(-5)\equiv -15^2\ \ \ {\rm by}\ \ \ \color{#c00}{2n}\equiv -7\ \ \, ({\rm mod}\ \ p = 2n\!+\!7)\\ \\ \Rightarrow\ \ \ \pm64 &\equiv&\, 225,\ \ \ {\rm i.e.}\ \ \ p\mid 225\pm 64\\ \end{eqnarray}$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.