login
A172990
a(n) is the smallest k such that the two numbers n^3 +- k are primes.
4
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, 9, 18, 73, 192, 75, 14, 63, 54, 7, 54, 255, 38, 303, 42, 11, 114, 63, 4, 33, 180, 5, 30, 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
OFFSET
2,1
LINKS
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
Sequence in context: A281230 A323977 A322359 * A084252 A342161 A287199
KEYWORD
nonn
AUTHOR
EXTENSIONS
Name and Example section edited by Jon E. Schoenfield, Jul 31 2019
STATUS
approved