login
A330407
Number of ordered integer pairs (b,c) with -n <= b <= n and -n <= c <= n such that both roots of x^2 + b*x + c = 0 are distinct integers.
0
0, 3, 7, 13, 20, 26, 36, 42, 52, 59, 69, 75, 89, 95, 105, 115, 126, 132, 146, 152, 166, 176, 186, 192, 210, 217, 227, 237, 251, 257, 275, 281, 295, 305, 315, 325, 344, 350, 360, 370, 388, 394, 412, 418, 432, 446, 456, 462, 484, 491, 505, 515, 529, 535, 553, 563, 581
OFFSET
0,2
FORMULA
a(n) = A067274(n) - A001650(n+1) for n > 1.
EXAMPLE
For n = 1, the a(1) = 3 equations are x^2 - x = 0, x^2 + x = 0, and x^2 - 1 = 0.
For n = 2, the a(2) = 7 equations are the 3 equations listed above and x^2 - 2x = 0, x^2 + 2x = 0, x^2 - x - 2 = 0, and x^2 + x - 2 = 0.
MATHEMATICA
ok[b_, c_] := Block[{d = b^2 - 4 c}, d > 0 && IntegerQ@ Sqrt@ d]; a[n_] := Sum[ Boole@ ok[b, c], {b, -n, n}, {c, -n, n}]; Array[a, 57, 0] (* Giovanni Resta, Jan 28 2020 *)
PROG
(Python 3.7) [sum([1 for b in range(-n, n+1) for c in range(-n, n+1) if b**2-4*c > 0 and int((-b+(b**2-4*c)**0.5)/2) == (-b+(b**2-4*c)**0.5)/2]) for n in range(0, 101)]
(PARI) isok(b, c) = (b^2 > 4*c) && issquare(b^2-4*c);
a(n) = sum(b=-n, n, sum(c=-n, n, isok(b, c))); \\ Michel Marcus, Jan 28 2020
CROSSREFS
Sequence in context: A106080 A187819 A310266 * A014283 A341299 A294398
KEYWORD
nonn
AUTHOR
Alexander Piperski, Jan 25 2020
EXTENSIONS
a(0)=0 prepended by Michel Marcus, Jan 30 2020
STATUS
approved