OFFSET
1,2
COMMENTS
All terms except the first term must be even numbers. - Harvey P. Dale, Jul 01 2023
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..75
EXAMPLE
2^2-+1=primes, 3^3=27-+4=primes, 5^5=3125-+42=3083,3167=primes, 7^7=823543-+186=823357,823729=primes, ...
MATHEMATICA
lst={1}; Do[p=Prime[n]; pp=p^p; Do[If[PrimeQ[pp-k]&&PrimeQ[pp+k], If[pp-k<2, Break[]]; AppendTo[lst, k]; Print[p.k]; Break[]], {k, 2, 10^9}], {n, 4!}]; lst
f[n_] := Block[ {pp = Prime[n]^Prime[n], k = If[n == 1, 1, 2]}, While[ !PrimeQ[pp - k] || !PrimeQ[pp + k], k += 2]; k]; lst = {}; Do[a = f@n; AppendTo[lst, a]; Print[{Prime@n, a}], {n, 100}] (* Robert G. Wilson v, Mar 20 2009 *)
skp[p_]:=Module[{k=1, p2=p^p}, While[AnyTrue[p2+{k, -k}, CompositeQ], k++]; k]; Table[skp[p], {p, Prime[Range[40]]}] (* Harvey P. Dale, Jul 01 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Joseph Stephan Orlovsky, Mar 04 2009
EXTENSIONS
a(13) onwards from Robert G. Wilson v, Mar 20 2009
STATUS
approved