login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A357365
Primes q such that either p^(q-1) == 1 (mod q^2) or q^(p-1) == 1 (mod p^2), where p = A151799(A151799(A151799(A151799(q)))).
3
19, 67, 349, 2011, 22307, 13699249, 2018905087, 9809844767
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