%I #59 Jan 08 2021 21:49:51
%S 2,17,73,73,241,241,1009,1009,1009,1009,1009,2521,2521,2521,2521,2521,
%T 8089,8089,8089,8089,8089,8089,19009,19009,19009,19009,19009,19009,
%U 53881,53881,53881,53881,53881,53881,53881,605641,605641,605641,605641,605641,605641
%N Smallest prime numbers which can be represented as x^2 + h*y^2 with x > 0 for every h in the first n idoneal numbers.
%C The sequence lists prime numbers, in nondecreasing order, such that each of them can be written, in a unique way, in the form x^2 + h*y^2, where x, y are natural numbers, while h takes an increasing number of values of the sequence A000926 (idoneal numbers). See examples.
%H Marco Frigerio, <a href="/A338088/b338088.txt">Table of n, a(n) for n = 1..65</a>
%e a(1) = 2 because, for A000926(1) = 1, 2 = 1^2+A000926(1)*1^2.
%e a(2) = 17 because, considered the first two idoneal numbers, A000926(1) = 1 and A000926(2) = 2, 17 = 1^2+A000926(1)*4^2 = 3^2+A000926(2)*2^2.
%e The prime 1009 is present in the sequence 5 times because:
%e a(7) = 15^2+1*28^2 = 19^2+2*18^2 = 31^2+3*4^2 = 15^2+4*14^2 = 17^2+5*12^2 = 25^2+6*12^2 = 1^2+7*12^2, with idoneal numbers up to A000926(7), and also:
%e a(8) = 19^2+8*9^2,
%e a(9) = 28^2+9*5^2,
%e a(10) = 3^2+10*10^2,
%e a(11) = 31^2+12*2^2,
%e with idoneal numbers from A000926(8) to A000926(11).
%e 1083289 is the last term of the sequence since for every idoneal number h there are x, y such that 1083289 = x^2 + h*y^2 and this is the least prime for which this is possible.
%o (PARI)
%o isok(p,u)={for(i=1, #u, my(s=qfbsolve(Qfb(1,0,u[i]),p)); if(s==0  s[1]==0, return(0))); 1}
%o idoneal()={select(m>!#select(k>k<>2, quadclassunit(4*m).cyc), [1..1848])}
%o seq()={my(u=idoneal(), v=[1], L=List()); forprime(p=2, oo, if(isok(p,v), listput(L,p); my(k=#v); while(k<#u && isok(p,[u[k+1]]), listput(L,p); k++); if(k==#u, return(Vec(L))); v=u[1..k+1]))} \\ _Andrew Howroyd_, Nov 05 2020
%Y Cf. A000926.
%K nonn,fini,full
%O 1,1
%A _Marco Frigerio_, Oct 09 2020
