What is the remainder when $p!$ is divided by $p+1$?

Hint: Both $2$ and $(p+1)/2$ appear as factors in $p!$.


Remember that if $p > 7$, then $p! = 1 \times 2 \times 3 \times \ldots \times (p - 1) \times p$.

The smallest prime factor of $p + 1$ is less than $\sqrt{p + 1}$ and clearly $\lceil \sqrt{p + 1} \rceil < p$. The largest prime factor of $p + 1$ is at most $\frac{p + 1}{2}$, which is also less than $p$.

This means that all the prime factors of $p + 1$ are included among the prime factors of $p!$, and in greater numbers. Therefore $(p + 1) \mid p!$.

For example, given $p = 11$, we have $p! = 39916800 = 2^8 \times 3^4 \times 5^2 \times 7 \times 11$. By contrast, $p + 1 = 12 = 2^2 \times 3^{(1)}$, so $$\frac{39916800}{12} = 3326400 = 2^6 \times 3^3 \times 5^2 \times 7 \times 11.$$