OFFSET
1,1
REFERENCES
J. B. Cosgrave, A Mersenne-Wieferich Odyssey, Manuscript, May 2022. See Section 18.5.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..3100
PROG
(Python)
from itertools import islice
from sympy import factorial, nextprime
def agen(): # generator of terms
p = 5
while True:
X = (p-1)//2
Xf = factorial(X)**2
if all(pow(factorial(Y), 2, p)+1 != p for Y in range(X-1, 0, -1)):
yield p
p = nextprime(p)
while p%4 != 1:
p = nextprime(p)
print(list(islice(agen(), 5))) # Michael S. Branicky, May 30 2022
(PARI) is(n)=if(n%4 != 1 || !isprime(n), return(0)); my(t1=lift(sqrt(Mod(-1, n))), t2=n-t1, t=Mod(1, n)); for(k=2, n\2, if(t==t1 || t==t2, return(0)); t*=k); 1 \\ Charles R Greathouse IV, Aug 03 2023
(PARI) list(lim)=my(v=List()); forprimestep(p=5, lim\1, 4, my(t1=lift(sqrt(Mod(-1, p))), t2=p-t1, t=Mod(1, p)); for(k=2, p\2, if(t==t1 || t==t2, next(2)); t*=k); listput(v, p)); Vec(v) \\ Charles R Greathouse IV, Aug 03 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, May 29 2022, based on Section 18.5 of Cosgrave (2022)
EXTENSIONS
a(20) and beyond from Michael S. Branicky, May 30 2022
STATUS
approved