Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #11 Dec 12 2024 15:19:04
%S 13,17,31,41,29,73,37,41,61,89,53,73,61,151,109,73,157,97,101,89,109,
%T 97,101,241,109,113,157,137,-1,241,149,137,157,257,149,193,157,367,
%U 181,281,173,193,181,421,229,193,197,241,317,499,229,233,-1,241,229,233,277,241,-1,409,269,257,277
%N a(n) is the least prime of the form p^2 + n*q^2 where p and q are primes, or -1 if there are none.
%C Green and Sawhney (see link) proved that there are infinitely many such primes if n == 0 or 4 (mod 6).
%C If n is odd, p or q must be 2.
%C If n == 2 (mod 3), p or q must be 3.
%C Thus if n == 5 (mod 6), the only possible primes of this form are 9 + 4 n and 4 + 9 n.
%H Robert Israel, <a href="/A378964/b378964.txt">Table of n, a(n) for n = 1..10000</a>
%H B. Green and M. Sawhney, <a href="https://arxiv.org/abs/2410.04189">Primes of the form p^2 + n q^2</a>, arXiv:2410.04189 [math.NT], 2024.
%e a(6) = 73 because 73 = 7^2 + 6 * 2^2 is the least prime of the form p^2 + 6 * q^2.
%p f:= proc(n) uses priqueue;
%p local pq, p, t;
%p if n mod 6 = 5 then
%p if isprime(3^2 + n * 2^2) then return 3^2 + n*2^2
%p elif isprime(2^2 + n*3^2) then return 2^2 + n*3^2
%p else return -1
%p fi fi;
%p initialize(pq);
%p insert([-9 - 4*n,3,2],pq);
%p insert([-4 - 9*n,2,3],pq);
%p if n mod 3 = 2 then
%p do
%p t:= extract(pq);
%p if isprime(-t[1]) then return -t[1] fi;
%p if t[2] = 3 then p:= nextprime(t[3]); if p = 3 then p:= 5 fi; insert([-9 - n*p^2,3,p],pq) fi;
%p if t[3] = 3 then p:= nextprime(t[2]); if p = 3 then p:= 5 fi; insert([-p^2 - n*9,p,3],pq) fi;
%p od
%p else
%p do
%p t:= extract(pq);
%p if isprime(-t[1]) then return -t[1] fi;
%p if t[3] = 2 then p:= nextprime(t[2]); insert([-p^2 - n*4 , p, 2],pq) fi;
%p if t[2] = 2 or n::even then
%p p:= nextprime(t[3]); insert([-t[2]^2 - n*p^2,t[2],p],pq)
%p fi;
%p od
%p fi
%p end proc:
%p map(f, [$1..200]);
%Y Cf. A111199 (a(n) = 9+4*n).
%K sign,look,new
%O 1,1
%A _Robert Israel_, Dec 12 2024