%I #28 Mar 29 2023 15:38:44
%S 3,5,7,11,23,29,43,47,53,113,127,131,157,163,167,173,179,181,277,281,
%T 283,293,347,349,353,359,367,373,379,509,521,523,541,547,821,823,827,
%U 829,839,853,857,859,863,937,941,947,953,967,971,977,983,991,1361
%N Primes p such that the nearest integer to sqrt(p) is also prime.
%H Robert Israel, <a href="/A360567/b360567.txt">Table of n, a(n) for n = 1..10000</a>
%e sqrt(11) = 3.3166247..., which when rounded is 3, and both 3 and 11 are prime, so 11 is in the sequence.
%p R:= NULL: count:= 0:
%p q:=1:
%p while count < 100 do
%p q:= nextprime(q);
%p p:= floor((q-1/2)^2);
%p u:= (q+1/2)^2;
%p while count < 100 do
%p p:= nextprime(p);
%p if p > u then break fi;
%p R:= R,p; count:= count+1;
%p od
%p od:
%p R; # _Robert Israel_, Mar 29 2023
%t Select[Prime[Range[500]],PrimeQ[Round[Sqrt[#]]] &]
%o (Python)
%o from itertools import islice
%o from math import isqrt
%o from sympy import isprime, nextprime
%o def A360567_gen(): # generator of terms
%o p = 1
%o while p:=nextprime(p):
%o if isprime((m:=isqrt(p))+int(p-m*(m+1)>=1)):
%o yield p
%o A360567_list = list(islice(A360567_gen(),20)) # _Chai Wah Wu_, Feb 27 2023
%Y Cf. A000194, A248170.
%K nonn
%O 1,1
%A _Rhys Feltman_, Feb 11 2023