OFFSET
1,1
COMMENTS
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
N:= 10^5: # to get terms <= N
R:= 3:
for b from 2 while b^2+1 <= N do
p:= 2:
do
p:= nextprime(p);
if b^p-1 > N then break fi;
if isprime(b^p-1) then R:= R, b^p-1 fi;
od:
p:= 1:
do
p:= 2*p;
if b^p+1 > N then break fi;
if isprime(b^p+1) then R:= R, b^p+1 fi;
od;
od:
sort(convert({R}, list)); # Robert Israel, Jan 08 2018
MATHEMATICA
Select[Prime@ Range[2, 10^4], AnyTrue[# + {-1, 1}, Or[# == 1, GCD @@ FactorInteger[#][[All, -1]] > 1] &] &] (* Michael De Vlieger, Dec 13 2017 *)
PROG
(PARI) lista(nn) = {forprime(p=2, nn, if ((p==2) || ispower(p+1) || ispower(p-1), print1(p, ", ")); ); } \\ Michel Marcus, Dec 13 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Nathaniel J. Strout, Dec 12 2017
STATUS
approved