A296422 Primes that can be represented in the form b^n+1 or b^n-1 where b >= 2 and n >= 2.
3, 5, 7, 17, 31, 37, 101, 127, 197, 257, 401, 577, 677, 1297, 1601, 2917, 3137, 4357, 5477, 7057, 8101, 8191, 8837, 12101, 13457, 14401, 15377, 15877, 16901, 17957, 21317, 22501, 24337, 25601, 28901, 30977, 32401, 33857, 41617, 42437, 44101, 50177, 52901
Offset: 1
Keywords
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
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 *)
-
PARI
lista(nn) = {forprime(p=2, nn, if ((p==2) || ispower(p+1) || ispower(p-1), print1(p, ", ")); ); } \\ Michel Marcus, Dec 13 2017
Comments