%I #11 Dec 11 2022 11:55:58
%S 3,5,3,3,5,5,3,7,3,5,5,3,3,7,5,11,5,3,7,5,5,3,13,3,5,11,3,13,5,5,5,5,
%T 7,7,5,31,5,7,3,11,19,3,3,5,11,5,5,3,7,19,5,3,11,5,5,5,3,7,5,31,5,5,3,
%U 3,19,11,3,7,5,11,41,17,13,13,5,29,5,7,3,5,5,5,13,13,5,5,3,11,13,5,19
%N a(n) is the least prime p such that (2*n+1)^2 + p^2 is twice a prime.
%C If n == 0 or 4 (mod 5), a(n) == 0, 1 or 4 (mod 5).
%C If n == 1 or 3 (mod 5), a(n) == 0, 2 or 3 (mod 5).
%C If n == 2 (mod 5), a(n) == 1, 2, 3 or 4 (mod 5).
%H Robert Israel, <a href="/A358790/b358790.txt">Table of n, a(n) for n = 0..10000</a>
%e a(3) = 3 because 3 is prime, (2*3+1)^2 + 3^2 = 2*29 where 29 is prime, and no smaller prime than 3 works.
%p f:= proc(n) local s,p;
%p s:= (2*n+1)^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 map(f, [$0..100]);
%t a[n_] := Module[{p = 3}, While[! PrimeQ[((2*n + 1)^2 + p^2)/2], p = NextPrime[p]]; p]; Array[a, 100, 0] (* _Amiram Eldar_, Dec 01 2022 *)
%K nonn
%O 0,1
%A _J. M. Bergot_ and _Robert Israel_, Dec 01 2022
