OFFSET
2,1
LINKS
Marius A. Burtea, Table of n, a(n) for n = 2..5001
EXAMPLE
Both 2^3 - 3 = 5 and 2^3 + 3 = 11 are prime, and there is no positive number k < 3 for which this is the case, so a(2) = 3; similarly,
both 3^3 - 4 = 23 and 3^3 + 4 = 31 are prime;
both 4^3 - 3 = 61 and 4^3 + 3 = 67 are prime;
both 5^3 - 12 = 113 and 5^3 + 12 = 137 are prime.
MATHEMATICA
f[n_]:=Block[{k}, If[OddQ[n], k=2, k=1]; While[ !PrimeQ[n-k]||!PrimeQ[n+k], k+=2]; k]; Table[f[n^3], {n, 2, 40}]
PROG
(Magma) sol:=[]; for m in [2..80] do k:=1; while k le 1000 and not(IsPrime(m^3-k) and IsPrime(m^3+k)) do k:=k+1; end while; sol[m-1]:=k; end for; sol; // Marius A. Burtea, Jul 31 2019
(MATLAB) m=1; for n=2:80 for k=1:1000 if and(isprime(n^3-k)==1, isprime(n^3+k)==1) sol(m)=k; m=m+1; break; end; end; end; sol % Marius A. Burtea, Jul 31 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Joseph Stephan Orlovsky, Feb 07 2010
EXTENSIONS
Name and Example section edited by Jon E. Schoenfield, Jul 31 2019
STATUS
approved