OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
p = 5 is a term, because then q = 3, and 3*2 = 6 == 1 (mod 5).
p = 23 is a term, because then q = 19, and 19*17 = 323 == 1 (mod 23).
MAPLE
for n from 1 to 300 do
X := ithprime(n);
Y := ithprime(n+1);
Z := 1/X mod Y;
if Z < X and isprime(Z) then print(Y);
end if:
end do:
MATHEMATICA
aQ[p_]:=Module[{p1=NextPrime[p, -1]}, ans=False; p2=2; While[p2<p1, If[Mod[p1*p2, p]==1, ans=True; Break[]]; p2=NextPrime[p2]]; ans]; Select[Prime[Range[317]], aQ] (* Amiram Eldar, Nov 10 2018 *)
PROG
(PARI) is(n) = my(q=precprime(n-1)); forprime(r=1, q-1, if(Mod(r*q, n)==1, return(1))); 0
forprime(p=1, , if(is(p), print1(p, ", "))) \\ Felix Fröhlich, Nov 10 2018
(PARI) upto(n) = {my(q = 3, r, res = List()); forprime(p = 5, n, r = gcdext(q, p)[1]; while(r < 0, r+=p); if(isprime(r), listput(res, p)); q = p); res} \\ David A. Corneth, Nov 10 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
David James Sycamore, Nov 10 2018
EXTENSIONS
More terms from Felix Fröhlich, Nov 10 2018
STATUS
approved