Lerch Quotients, Lerch Primes, Fermat-Wilson Quotients, and the Wieferich-Non-Wilson Primes 2, 3, 14771

Conference paper
Part of the Springer Proceedings in Mathematics & Statistics book series (PROMS, volume 101)


The Fermat quotient \(q_{p}(a):= (a^{p-1} - 1)/p\), for prime p∤ a, and the Wilson quotient \(w_{p}:= ((p - 1)! + 1)/p\) are integers. If pw p , then p is a Wilson prime. For odd p, Lerch proved that \((\sum\nolimits_{a=1}^{p-1}q_{p}(a) - w_{p})/p\) is also an integer; we call it the Lerch quotient  p . If p p we say p is a Lerch prime. A simple Bernoulli number test for Lerch primes is proven. There are four Lerch primes 3, 103, 839, 2237 up to 3 × 106; we 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\mid q_{p}(a)\), then p is a Wieferich prime base a; we give a survey of them. Taking a = w p , if \(p\mid q_{p}(w_{p})\) we say p is a Wieferich-non-Wilson prime. There are three up to 107, namely, 2, 3, 14771. Several open problems are discussed.


Fermat quotient Wilson quotient Wilson prime Lerch’s formula Bernoulli number Faulhaber’s formula von Staudt-Clausen theorem Glaisher’s congruence E. Lehmer’s test Mathematica Wieferich prime abc-conjecture 

MSC 2010:

11A41 (primary) 11B68 (secondary) 



I am grateful to Wadim Zudilin for suggestions on the test, for a simplification in computing WW primes, and for verifying that there are no new ones up to 30000, using PARI/GP [24]. I thank Marek Wolf for computing Lerch primes and Michael Mossinghoff for computing WW primes.


  1. 1.
    T. Agoh, K. Dilcher, L. Skula, Wilson quotients for composite moduli. Math. Comp. 67, 843–861 (1998)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    J.H. Conway, R.K. Guy, The Book of Numbers (Springer, New York, 1996)CrossRefzbMATHGoogle Scholar
  3. 3.
    J.B. Cosgrave, K. Dilcher, Extensions of the Gauss-Wilson theorem. Integers 8, article A39 (2008)Google Scholar
  4. 4.
    E. Costa, R. Gerbicz, D. Harvey, A search for Wilson primes (2012, preprint); available at
  5. 5.
    R. Crandall, K. Dilcher, C. Pomerance, A search for Wieferich and Wilson primes. Math. Comp. 66, 433–449 (1997)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    P.J. Davis, Are there coincidences in mathematics? Am. Math. Mon. 88, 311–320 (1981)CrossRefzbMATHGoogle Scholar
  7. 7.
    L.E. Dickson, History of the Theory of Numbers, vol. 1. (Carnegie Institution of Washington, Washington, D.C. 1919); reprinted by (Dover, Mineola, NY 2005)Google Scholar
  8. 8.
    K. Dilcher, A bibliography of Bernoulli numbers (2011); available at
  9. 9.
    J.B. Dobson, On Lerch’s formula for the Fermat quotient (2012, preprint); available at
  10. 10.
    F.G. Dorais, D.W. Klyve, A Wieferich prime search up to 6. 7 × 1015. J. Integer Seq. 14, Article 11.9.2 (2011); available at
  11. 11.
    F. Eisenstein, Eine neue Gattung zahlentheoretischer Funktionen, welche von zwei Elementen abhaengen und durch gewisse lineare Funktional-Gleichungen definiert werden, Verhandlungen der Koenigl. Preuss. Akademie der Wiss. zu Berlin 36–42 (1850); reprinted in vol. 2 (Mathematische Werke, Chelsea, New York 1975) pp. 705–711Google Scholar
  12. 12.
    J.W.L. Glaisher, A congruence theorem relating to Eulerian numbers and other coefficients. Proc. Lond. Math. Soc. 32, 171–198 (1900)MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    GMP: The GNU Multiple Precision Arithmetic Library (2011); available at
  14. 14.
    K. Goldberg, A table of Wilson quotients and the third Wilson prime. J. Lond. Math. Soc. 28, 252–256 (1953)CrossRefzbMATHGoogle Scholar
  15. 15.
    R.K. Guy, The strong law of small numbers. Am. Math. Mon. 95, 697–712 (1988)MathSciNetCrossRefzbMATHGoogle Scholar
  16. 16.
    R.K. Guy, Unsolved Problems in Number Theory, 3rd edn. (Springer, New York 2004)CrossRefzbMATHGoogle Scholar
  17. 17.
    G.H. Hardy, E.M. Wright, An Introduction to the Theory of Numbers, 5th edn. (Oxford University Press, Oxford 1989)Google Scholar
  18. 18.
    Klaster Instytutu Fizyki Teoretycznej UWr (2012);
  19. 19.
    D. Knuth, Johann Faulhaber and sums of powers. Math. Comp. 61, 277–294 (1993)MathSciNetCrossRefzbMATHGoogle Scholar
  20. 20.
    E. Lehmer, A note on Wilson’s quotient. Am. Math. Mon. 44, 237–238 (1937)MathSciNetCrossRefzbMATHGoogle Scholar
  21. 21.
    M. Lerch, Zur Theorie des Fermatschen Quotienten \(\frac{a^{p-1}-1} {p} = q(a)\). Math. Ann. 60, 471–490 (1905)MathSciNetCrossRefzbMATHGoogle Scholar
  22. 22.
    D. MacHale, Comic Sections: The Book of Mathematical Jokes, Humour, Wit and Wisdom (Boole Press, Dublin 1993)Google Scholar
  23. 23.
    P.L. Montgomery, New solutions of \(a^{\,p-1} \equiv 1\pmod p^{\,2}\). Math. Comp. 61, 361–363 (1993)MathSciNetzbMATHGoogle Scholar
  24. 24.
    PARI/GP (2011); available at
  25. 25.
    P. Ribenboim, 1093. Math. Intelligencer 5, 28–34 (1983)Google Scholar
  26. 26.
    P. Ribenboim, The Book of Prime Number Records, 2nd. edn. (Springer, New York, 1989)Google Scholar
  27. 27.
    P. Ribenboim, My Numbers, My Friends: Popular Lectures on Number Theory (Springer, New York, 2000)zbMATHGoogle Scholar
  28. 28.
    J.H. Silverman, Wieferich’s criterion and the abc-conjecture. J. Number Theor. 30(2), 226–237 (1988)CrossRefzbMATHGoogle Scholar
  29. 29.
    N.J.A. Sloane, The On-Line Encyclopedia of Integer Sequences (2011); published at
  30. 30.
    J. Sondow, K. MacMillan, Reducing the Erdős-Moser equation \(1^{n} + 2^{n} + \cdots + k^{n} = (k + 1)^{n}\) modulo k and k 2. Integers 11, article A34 (2011); expanded version available at
  31. 31.
    D. Wells, The Penguin Dictionary of Curious and Interesting Numbers (Penguin Books, London, 1986)Google Scholar
  32. 32.
    Wikipedia: Wieferich prime (2012);

Copyright information

© Springer Science+Business Media New York 2014

Authors and Affiliations

  1. 1.New YorkUSA

Personalised recommendations