login
Nonnegative integers of the form x^2+xy+10y^2.
2

%I #7 Mar 07 2023 08:46:08

%S 0,1,4,9,10,12,16,22,25,30,36,39,40,43,48,49,52,55,64,66,75,81,82,88,

%T 90,94,100,103,108,118,120,121,130,139,142,144,156,157,160,165,166,

%U 169,172,178,181,183,192,196,198,205,208,220,225,235,237,244,246,250,256,264,270,274,277,282,286,289

%N Nonnegative integers of the form x^2+xy+10y^2.

%C Discriminant -39.

%H Jean-François Alcover, <a href="/A243194/b243194.txt">Table of n, a(n) for n = 0..1611</a>

%H N. J. A. Sloane et al., <a href="https://oeis.org/wiki/Binary_Quadratic_Forms_and_OEIS">Binary Quadratic Forms and OEIS</a> (Index to related sequences, programs, references)

%p fd:=proc(a,b,c,M) local dd,xlim,ylim,x,y,t1,t2,t3,t4,i;

%p dd:=4*a*c-b^2;

%p if dd<=0 then error "Form should be positive definite."; break; fi;

%p t1:={};

%p xlim:=ceil( sqrt(M/a)*(1+abs(b)/sqrt(dd)));

%p ylim:=ceil( 2*sqrt(a*M/dd));

%p for x from 0 to xlim do

%p for y from -ylim to ylim do

%p t2 := a*x^2+b*x*y+c*y^2;

%p if t2 <= M then t1:={op(t1),t2}; fi; od: od:

%p t3:=sort(convert(t1,list));

%p t4:=[];

%p for i from 1 to nops(t3) do

%p if isprime(t3[i]) then t4:=[op(t4),t3[i]]; fi; od:

%p [[seq(t3[i],i=1..nops(t3))], [seq(t4[i],i=1..nops(t4))]];

%p end;

%p fd(1,1,10,500);

%t Module[{k, r}, Reap[For[k = 0, k <= 1000, k++, r = Reduce[k == x^2 + x y + 10 y^2, {x, y}, Integers]; If[r =!= False,(* Print[k," ",r]; *) Sow[k]]]][[2, 1]]] (* _Jean-François Alcover_, Mar 07 2023 *)

%Y Primes: A033227.

%K nonn

%O 0,3

%A _N. J. A. Sloane_, Jun 08 2014