%I #8 Dec 06 2022 10:03:32
%S 0,1,3,15,31,45,143,81,233,151,71,353,141,537,457,1663,209,391,707,
%T 1081,1877,1161,3807,2361,5657,1399,2783,2967,3149,2923,5103,1109,
%U 11937,7211,2341,9311,6837,10303,24933,8273,11821,9931,11191,6377,14007,48111,12821,43967,27563,17171,38157,16859
%N a(n) is the least nonnegative integer k such that (k^2 + prime(n)^2)/2 is prime but (k^2 + prime(i)^2)/2 is not prime for i < n.
%F A358790((a(n)-1)/2) = prime(n) for n > 1.
%e a(4) = 15 because prime(4) = 7 and (15^2 + 7^2)/2 = 137 is prime while (15^2 + p^2)/2 is not prime for primes p < 7, and 15 is the least number that works.
%p g:= proc(n) local s, p;
%p s:= n^2; p:= 2;
%p do
%p p:= nextprime(p);
%p if isprime((s+p^2)/2) then return p fi
%p od
%p end proc:
%p N:= 100: # for a(1)..a(N)
%p M:= ithprime(N): V:= Vector(M,-1):
%p count:= 1: V[2]:= 0:
%p for n from 1 by 2 while count < N do
%p v:= g(n); if v <= M and V[v] = -1 then V[v]:= n; count:= count+1 fi;
%p od:
%p seq(V[ithprime(i)], i=1..N);
%t a[n_] := Module[{p = Prime[n], k = 0}, While[! PrimeQ[(k^2 + p^2)/2] || AnyTrue[Prime[Range[n - 1]], PrimeQ[(k^2 + #^2)/2] &], k++]; k]; Array[a, 50] (* _Amiram Eldar_, Dec 01 2022 *)
%Y Cf. A358790.
%K nonn
%O 1,3
%A _J. M. Bergot_ and _Robert Israel_, Dec 01 2022