Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #13 Oct 16 2022 16:34:44
%S 3,17,11,47521,43,149,26041,71,79,3607,97,107,6871,53,59,61,31397,71,
%T 73,179,2539,197,2777,599,223,647,107,61843,1520777,113,277,283,823,
%U 5743,313,139,254887,337,349,157,75797,1049,5197,173,179,409,2297,191,439,6047,457,892357,8951,242399,491
%N a(n) is the first prime p such that (p+q)/(2*n) is the square of a prime, where q is the next prime after p.
%H Robert Israel, <a href="/A357373/b357373.txt">Table of n, a(n) for n = 1..10000</a>
%e a(3) = 11 because (11+13)/(2*3) = 4 = 2^2 where 2 is prime, and 11 is the first prime that works.
%p f:= proc(n) local r,v,p,q;
%p r:= 1:
%p do
%p r:= nextprime(r);
%p v:= n*r^2;
%p p:= prevprime(v);
%p if 2*v-p = nextprime(v) then return p fi
%p od
%p end proc:
%p map(f, [$1..100]);
%t f[n_] := Module[{r, v, p, q}, r = 1; While[True, r = NextPrime[r]; v = n*r^2; p = NextPrime[v, -1]; If[2*v - p == NextPrime[v], Return[p]]]];
%t Table[f[n], {n, 1, 100}] (* _Jean-François Alcover_, Oct 16 2022, after _Robert Israel_ *)
%Y Cf. A357369
%K nonn
%O 1,1
%A _Robert Israel_, Sep 25 2022