OFFSET
1,1
COMMENTS
Note that the gap=4 is partitioned either as 2+2 or as 3+1; 1+3 never occurs since n^2-1 is composite if n>2.
EXAMPLE
n=3, n^2=9 is surrounded by closest primes: {7,[9],11};
n=10, n^2=100 is surrounded by {97,[100],101};
MATHEMATICA
Select[Range[3, 1500], NextPrime[#^2] == NextPrime[#^2, -1] + 4 &] (* Giovanni Resta, May 26 2018 *)
PROG
(PARI) isok(n) = nextprime(n^2) - precprime(n^2) == 4; \\ Michel Marcus, May 26 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, Jan 09 2004
STATUS
approved