OFFSET
1,1
LINKS
Bruno Berselli, Table of n, a(n) for n = 1..1000
EXAMPLE
p(1)=2, 2^3 = 8. for even k, 2^r + k is even and thus not prime, so we only need consider odd k.
for k = 1: 8 + 1 = 9, which is 3^2 and not prime.
for k = 3: 8 + 3 = 11, which is prime, so 3 is the smallest number that can be added to 8 to make a new prime.
Hence a(1) = 3.
MATHEMATICA
Table[NextPrime[Prime[n]^3] - Prime[n]^3, {n, 100}] (* Bruno Berselli, Sep 03 2013 *)
PROG
(PARI) a(n) = {k = 0; p3 = prime(n)^3; while (! isprime(p3+k), k++); k; } \\ Michel Marcus, Sep 03 2013
(PARI) a(n) = {p3 = prime(n)^3; nextprime(p3) - p3; } \\ Michel Marcus, Sep 03 2013
(Magma) [NextPrime(p^3)-p^3: p in PrimesUpTo(500)]; // Bruno Berselli, Sep 03 2013
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Carl R. White, Sep 14 2007
STATUS
approved