Riesel Number

Author

Eric W. Weisstein
October 25, 2003

This notebook downloaded from http://mathworld.wolfram.com/notebooks/IntegerSequences/RieselNumber.nb.

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

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

Code

SierpinskiRieselIndex::usage="SierpinskiRieselIndex[k,r,{n1,n2}] gives the smallest value of n such that k 2^n+r is prime for n=n1,...n2."

SierpinskiRieselList::usage="SierpinskiRieselList[k,r,num,max] gives the first num values of n such that k 2^n+r is prime for n<=num."

SierpinskiRieselQ::usage="SierpinskiReiselQ[k,r,nmax] returns True if k 2^n+r is composite for n<=nmax."

(*Sierpinski and Riesel Number*)SierpinskiRieselIndex[n_Integer?OddQ,sign_,its_Integer:1000]:=SierpinskiRieselIndex[n,sign,{1,its}]

SierpinskiRieselIndex[n_Integer?OddQ,sign_,{from_,to_}]:=Module[{i=from-1},While[i++<to&&!PrimeQ[n 2^i+sign]];
i]

SierpinskiRieselList[n_Integer?OddQ,sign_,k_,to_:1000]:=Module[{l={-1},i=0},While[i++<k,AppendTo[l,SierpinskiRieselIndex[n,sign,{l[[-1]]+1,to}]]];
Drop[l,1]]

SierpinskiRieselQ[n_Integer?OddQ,sign_,its_:1000]:=(SierpinskiRieselIndex[n,sign,its]==its+1)