OFFSET
1,2
COMMENTS
Discriminant = -7.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
N. J. A. Sloane et al., Binary Quadratic Forms and OEIS (Index to related sequences, programs, references)
MAPLE
PriRepBQF := proc(a, b, c, n) local L, q, R, r, k;
q := a*x^2 + b*x*y + c*y^2; L := NULL;
for k from 1 to n do
R := [isolve(q = k)];
if R = [] then next fi;
for r in R do
igcd(op(2, r[1]), op(2, r[2]));
if 1 = % then L := L, k; break fi od
od; L end:
# Alternate program
A244779_set:= proc(N) local A, B, y, x;
A:= {};
for y from 0 to floor(sqrt(4*N/7)) do
for x from ceil(-y/2) to floor(-y/2 + sqrt(N - 7/4*y^2)) do
if igcd(x, y) = 1 then
A:= A union {x^2 + x*y + 2*y^2}
fi
od
od;
A
end proc:
A244779_set(1000); # Robert Israel, Jul 06 2014
MATHEMATICA
Reap[For[n = 1, n < 1000, n++, r = Reduce[x^2 + x y + 2 y^2 == n, {x, y}, Integers]; If[r =!= False, If[AnyTrue[{x, y} /. {ToRules[r /. C[1] -> 0]}, CoprimeQ @@ # &], Sow[n]]]]][[2, 1]] (* Jean-François Alcover, Oct 31 2016 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Jul 06 2014
STATUS
approved