OFFSET
1,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
p(4)=7, 7^3 = 343; for odd k and n > 1, p(n)^r - k is even and thus not prime, so we only need consider even k.
for k = 2: 343 - 2 = 341, which is 11 * 31 and not prime.
for k = 4: 343 - 4 = 339, which is 3 * 113, also not prime.
for k = 6: 343 - 6 = 337, which is prime, so 6 is the smallest number that can be subtracted from 343 to make another prime.
Hence a(4) = 6.
MATHEMATICA
sk[n_]:=With[{c=Prime[n]^3}, c-NextPrime[c, -1]]; Array[sk, 80] (* Harvey P. Dale, May 07 2019 *)
PROG
(PARI) a(n) = {k = 0; while (! isprime(prime(n)^3 - k), k++); return (k); } \\Michel Marcus, Aug 02 2013
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Carl R. White, Sep 14 2007
STATUS
approved