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

%I #6 Jun 08 2014 17:28:06

%S 0,2,6,7,8,9,12,16,18,21,24,27,28,32,34,36,42,48,50,51,53,54,56,59,61,

%T 63,64,68,72,74,81,84,89,94,96,97,98,102,108,111,112,119,126,128,131,

%U 136,142,144,147,148,150,153,157,158,159,162,166,168,173,175,177,183,189,192,196,200,202,204,206

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

%C Discriminant -47.

%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(2,1,6,500);

%Y Primes: 106898.

%K nonn

%O 0,2

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