login
A157719
Smallest k such that p^p -+ k is prime, where p=prime(n).
1
1, 4, 42, 186, 1302, 114, 1980, 1638, 10800, 12882, 12972, 24324, 25602, 41706, 19236, 51864, 25752, 60672, 108936, 36468, 85176, 131718, 45216, 361710, 40716, 187998, 450684, 488784, 4842, 117450, 479304, 212610, 32670, 556062, 354432
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
Sequence in context: A089551 A347320 A220835 * A280956 A301943 A219101
KEYWORD
nonn
AUTHOR
EXTENSIONS
a(13) onwards from Robert G. Wilson v, Mar 20 2009
STATUS
approved