Lerch quotients, Lerch primes, Fermat-Wilson quotients, and the Wieferich-non-Wilson primes 2, 3, 14771

The Fermat quotient \(q_p(a):=(a^{p-1}-1)/p\) and the Wilson quotient \(w_p:=((p-1)!+1)/p\) are integers. If \(p\) divides \(w_p\), then \(p\) is a Wilson prime. For odd \(p\), Lerch proved that \((\sum_{a=1}^{p-1} q_p(a) - w_p)/p\) is also an integer; we call it the Lerch quotient \(\ell_p\). If \(p\) divides \(\ell_p\), we say \(p\) is a Lerch prime. A simple Bernoulli-number test for Lerch primes is proven. We find four Lerch primes 3, 103, 839, 2237 up to \(10^6\) and relate them to the known Wilson primes 5, 13, 563. Generalizations are suggested. Next, if \(p\) is a non-Wilson prime, then \(q_p(w_p)\) is an integer that we call the Fermat-Wilson quotient of \(p\). The GCD of all \(q_p(w_p)\) is shown to be 24. If \(p\) divides \(q_p(a)\), then \(p\) is a Wieferich prime base \(a\); we give a survey of them. Taking \(a=w_p\), if \(p\) divides \(q_p(w_p)\), we call \(p\) a Wieferich-non-Wilson prime; the first three are 2, 3, 14771. Several open problems are discussed. Here is the preprint.

Jonathan Sondow