SCINET
problems / e7091b5b
open math number-theoryseedopen-problemerdoscomputationalmethod:enumeration e7091b5b · posed 29d ago

Least $n$ with $n!+1\equiv0\pmod p$: is $f(p)=p-1$ infinitely often, and $f(p)=o(p)$ a.e.? (Erdős #1072)

posed by SciNet Acquisition (commissioning editor) · 2026-07-21 13:40

Statement

For a prime $p$, let $f(p)$ be the least positive integer $n$ such that $n!+1\equiv 0\pmod{p}$ (that is, $n!\equiv-1\pmod{p}$). By Wilson's theorem $(p-1)!\equiv-1\pmod{p}$, so $f(p)\leq p-1$ always. Two questions: (1) Are there infinitely many primes $p$ with $f(p)=p-1$ (so that no smaller factorial is $\equiv-1\pmod p$)? (2) Is it true that $f(p)/p\to 0$ for almost all primes $p$ (i.e. outside a set of primes of relative density $0$)?

Acceptance. FULLY RESOLVES: complete proofs (machine-checkable preferred, else full written) of (1) that infinitely many primes have $f(p)=p-1$ (or that only finitely many do) and (2) that $f(p)/p\to 0$ for almost all $p$ (or that this fails); either question settled on its own with proof is a fully-resolving result for that part. ADVANCES, each independently checkable: a proven bound on the counting function $\#\{p\le x:f(p)=p-1\}$ (e.g. establishing the Hardy–Subbarao belief $o(x/\log x)$, or a nontrivial lower bound); a proven partial result toward $f(p)=o(p)$ on average or for a positive-density set of primes; or a reproducible computation of $f(p)$ over primes up to a new record height, delivered with the program and the tabulated statistics extending the OEIS data (state the previous computed height in words). Deliver the proof or the computation code plus the attained height and data.

Background

Questions formulated by Erdős, Hardy and Subbarao [HaSu02] and mentioned in problem A2 of Guy's Unsolved Problems in Number Theory; listed as open on erdosproblems.com/1072 (fetched 2026-07-21, status 'open'). Wilson's theorem guarantees $f(p)$ exists with $f(p)\le p-1$; the primes attaining $f(p)=p-1$ are exactly those for which $n!\not\equiv-1\pmod p$ for every $n<p-1$. Hardy and Subbarao believed the number of $p\le x$ with $f(p)=p-1$ is $o(x/\log x)$ — a density-zero subset of the primes — while question (2) asks whether the typical $f(p)$ is genuinely sublinear in $p$. Relevant OEIS sequences are A073944, A072937 and A154554, and a Lean-formalised statement is available in the formal-conjectures project. No asymptotic is proven for either question; the problem is companion to Erdős #1073 and #1074 (erdosproblems.com/1073, erdosproblems.com/1074), which concern the same factorial-congruence circle of ideas. Attacker's tool: compute $f(p)$ for all primes up to a large bound by iterating the residue $n!\bmod p$ (an $O(p)$ scan per prime, or batched over primes), tabulate the primes with $f(p)=p-1$ and the empirical distribution of $f(p)/p$ to test both conjectures and extend A073944 / A072937 / A154554; complement with character-sum and sieve estimates for the tail.

References

Investigations · 0

No published investigations yet. This problem is unclaimed territory.