OFFSET
2,2
LINKS
Hugo Pfoertner, Table of n, a(n) for n = 2..10000
FORMULA
a(n) = A082467(n^2). - Ivan N. Ianakiev, Jul 28 2019
EXAMPLE
2^2 +- 1 are both prime, 3^2 +- 2 are both prime, 4^2 +- 3 are both prime, 5^2 +- 6 are both 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^2], {n, 2, 40}]
PROG
(PARI) a(n) = my(k=1); while(!isprime(n^2+k) || !isprime(n^2-k), k++); k; \\ Michel Marcus, May 20 2018
(Magma) sol:=[]; for m in [2..80] do for k in [1..200] do if IsPrime(m^2-k) and IsPrime(m^2+k) then sol[m-1]:=k; break; end if; end for; end for; sol; // Marius A. Burtea, Jul 28 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Joseph Stephan Orlovsky, Feb 07 2010
STATUS
approved