

A340431


Primes p such that, with q the next prime after p, q > p+2 and q^p == q (mod p+q) and p^q == p (mod p+q).


0



13, 211, 421, 523, 154321, 221941, 1556641, 2377201, 3918757, 4359961, 7842511, 9163873, 20446561, 1501102081, 7578849037, 15724210681, 25522638481, 52966796353, 68999668237, 109926997057, 112417709113, 209826685297, 694503347201, 963374692897
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

For twin primes p,q we always have p^q == p (mod p+q) and q^p == q (mod p+q).


LINKS



EXAMPLE

a(3) = 421 is a term because the next prime is 431, 421^431 == 421 (mod 852) and 431^421 == 431 (mod 852).


MAPLE

q:= 2: R:= NULL:
while p < 10^7 do
p:= q; q:= nextprime(p);
if qp = 2 then next fi;
if q &^ p mod (p+q) = q and p &^ q mod (p+q) = p then
R:= R, p;
fi;
od:
R;


PROG

(Python)
from sympy import nextprime
while p <= 10**10:
q = nextprime(p)
if q > p+2:
pq = p+q
if pow(q, p, pq) == q and pow(p, q, pq) == p:
(PARI) upto(n) = my(p=2); forprime(q = nextprime(p+1), n, if(qp > 2, if(Mod(p, p+q)^q == p, if(Mod(q, p+q)^p == q, print1(p, ", ")))); p = q); \\ Daniel Suteu, Jan 12 2021


CROSSREFS



KEYWORD

nonn,more


AUTHOR



EXTENSIONS



STATUS

approved



