For all prime numbers $p>5$ there exist a prime number $q<p$ such that $q\equiv m!\!\pmod p$, for some $m$ with $2<m<p$.


For all primes $p$ there is a prime $q<p^2$ such that $q\equiv m!\pmod {p^2}$, for some $m$ with $2<m<p^2$. (Even $2<m<p$ as pointed out in comment).

Both tested for all $p<100,000,000$.

There are reasons to believe that the conjectures are true. If $p$ is a large prime there are a lot of nonzero solutions to $n\equiv m!\!\pmod p$ and to $n\equiv m!\!\pmod {p^2}$. The probability for one of those $n$ to be a prime increase with p.


  • $\begingroup$ If $p$ is prime then $m!\equiv0\bmod{p^2}$ for all $m\ge2p$, indeed $m!$ is divisible by $p$ for all $m\ge p$, and there is no prime $q$ satisfying either condition except $q=p$. $\endgroup$ – Gerry Myerson Jul 6 '16 at 5:43
  • $\begingroup$ @GerryMyerson: yes, the condition for $m$ in the second conjecture could be $2<m<p$. The statement "It exist a prime $q<n$ so that $q\equiv m!\pmod n$, for some $m$ with $2<m<n$" is true for almost 1/3 of all numbers $n$, as it seems, and I wanted to expose the general form. $\endgroup$ – Lehs Jul 6 '16 at 6:06

You might consider the inverse problem: for small m and prime q, factorize m! - q. Note that when q is greater than m all such prime factors of the difference must also be greater than m. Thus for many prime factors p, m is a solution of the desired congruence. Your question now becomes how many prime factors p are covered this way for a small assortment of m. For example, for m=5, all the primes p between 73 and 113 have 120 equal a prime modulo p, since 120-p has to be less than 49 and have all prime factors greater than 7. This reasoning should be generalizable to the point of showing that exceptional primes p are either less than 7 or have density 0 in the primes.

Gerhard "Turns It Over To Professionals" Paseman, 2016.07.06.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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