OFFSET
1,1
PROG
(PARI) is(n) = my(b=precprime(precprime(precprime(precprime(n-1)-1)-1)-1)); Mod(b, n^2)^(n-1)==1 || Mod(n, b^2)^(b-1)==1
forprime(p=11, , if(is(p), print1(p, ", ")))
(Python)
from sympy import nextprime
from itertools import islice
def agen():
p, m1, m2, m3, q = 2, 3, 5, 7, 11
while True:
if pow(p, q-1, q*q) == 1 or pow(q, p-1, p*p) == 1: yield q
p, m1, m2, m3, q = m1, m2, m3, q, nextprime(q)
print(list(islice(agen(), 5))) # Michael S. Branicky, Sep 30 2022
CROSSREFS
KEYWORD
nonn,hard,more
AUTHOR
Felix Fröhlich, Sep 25 2022
EXTENSIONS
a(7)-a(8) from Michael S. Branicky, Sep 26 2022
STATUS
approved