OFFSET
1,2
COMMENTS
From Robert Israel, Jan 03 2017: (Start)
For n > 1, a(n) == n (mod 2) unless it is 0.
a(191) > 3*10^7 if it is not 0. (End)
LINKS
Robert Israel, Table of n, a(n) for n = 1..190
MAPLE
N:= 100: # for a(1)..a(N)
R[1]:= 1: count:= 1:
for k from 3 while count < N do
d:= min(nextprime(k^2)-k^2, k^2-prevprime(k^2));
if d <= N and not assigned(R[d]) then R[d]:= k; count:= count+1 fi
od:
seq(R[i], i=1..N); # Robert Israel, Jan 03 2017
PROG
(PARI) a(n)=if(n<0, 0, s=1; while(abs(n-min(abs(precprime(s^2)-s^2), abs(nextprime(s^2)-s^2)))>0, s++); s)
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Jan 26 2003
EXTENSIONS
More terms from Robert Israel, Jan 03 2017
STATUS
approved