login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo

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 60th year, we have over 367,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Other ways to Give
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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 q-p = 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
A340431_list , p = [], 2
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:
A340431_list.append(p)
p = q # Chai Wah Wu, Jan 12 2021
(PARI) upto(n) = my(p=2); forprime(q = nextprime(p+1), n, if(q-p > 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
Sequence in context: A296671 A196328 A362550 * A251093 A132542 A069989
KEYWORD
nonn,more
AUTHOR
J. M. Bergot and Robert Israel, Jan 12 2021
EXTENSIONS
a(15)-a(17) from Daniel Suteu, Jan 12 2021
a(18)-a(22) from Chai Wah Wu, Jan 15 2021
a(23)-a(24) from Martin Ehrenstein, Jan 19 2021
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 9 06:02 EST 2023. Contains 367685 sequences. (Running on oeis4.)