Wolstenholme Prime

Author

Eric W. Weisstein
November 3, 2005

This notebook downloaded from http://mathworld.wolfram.com/notebooks/PrimeNumbers/WolstenholmePrime.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/WolstenholmePrime.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Code

WolstenholmePrimeQ[n_Integer]:=Mod[Binomial[2n,n],n^4]==2
FractionalMod[r_Rational, m_Integer] := PolynomialMod[r,m]

Enumeration

Central Binomial

Select[Prime[Range[2000]],WolstenholmePrimeQ]//Timing

WolstenholmePrimeQ/@{16843,2124679}//Timing

Bernoulli

1+Select[Prime[Range[2,2000]],FractionalMod[BernoulliB[#-3],#]==0&]//Timing

FractionalMod[BernoulliB[#-3],#]&/@{16843,2124679}//Timing

MyMod[r_Rational, m_Integer] := Mod[
  Numerator[r]PowerMod[Denominator[r], -1, m], m]

MyMod[BernoulliB[#-3],#]&/@{16843,2124679}//Timing

Harmonic

Sum[(1/(k^3)),{k,Floor[p/6]+1,Floor[p/4]}]

FullSimplify[%,p∈Integers&&p>0]

Function[p,FractionalMod[(1/2) (-PolyGamma[2,1+Floor[(p/6)]]+PolyGamma[2,1+Floor[(p/4)]])//FunctionExpand,p]]/@{16843,2124679}//Timing

Select[Prime[Range[2000]],FractionalMod[(1/2) (-PolyGamma[2,1+Floor[((#)/6)]]+PolyGamma[2,1+Floor[((#)/4)]])//FunctionExpand,#]==0&]//Timing