%I #15 Sep 08 2022 08:45:50
%S 3,4,3,12,17,6,9,10,9,30,5,54,33,14,3,24,11,168,81,20,9,60,17,18,3,80,
%T 9,18,73,192,75,14,63,54,7,54,255,38,303,42,11,114,63,4,33,180,5,30,
%U 93,28,21,84,115,18,15,40,9,228,61,318,171,4,93,42,5,24,9,70,51,72,49,444,3
%N a(n) is the smallest k such that the two numbers n^3 +- k are primes.
%H Marius A. Burtea, <a href="/A172990/b172990.txt">Table of n, a(n) for n = 2..5001</a>
%e 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,
%e both 3^3 - 4 = 23 and 3^3 + 4 = 31 are prime;
%e both 4^3 - 3 = 61 and 4^3 + 3 = 67 are prime;
%e both 5^3 - 12 = 113 and 5^3 + 12 = 137 are prime.
%t 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}]
%o (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
%o (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
%Y Cf. A172989
%K nonn
%O 2,1
%A _Vladimir Joseph Stephan Orlovsky_, Feb 07 2010
%E Name and Example section edited by _Jon E. Schoenfield_, Jul 31 2019