%I #32 Sep 21 2023 15:52:29
%S 3,5,6,9,10,12,15,16,18,19,21,23,24,26,27,30,33,36,37,39,40,41,42,44,
%T 45,47,48,51,52,54,57,58,60,61,63,64,65,66,67,68,69,72,75,78,79,81,82,
%U 83,84,86,87,89,90,92,93,96,99,100,102,103,105,107,108,110,111,114,117,120,121,123,124,126,128,129,130,131,132,134,135,138,141,142,144,145,147,149,150,152,153,156,159,162,163,165,166,168,170,171,173,174,176,177,180,183,184,186,187,189,191,192,194,195,196,198,201,204
%N Positive integers whose square can be expressed as k*x^2+(k+1)*x+(k+2) with k and x positive integers.
%C Some can be expressed in more than one way. E.g., a(46) = 81 for x = 1, k = 26 and for x = 2 and k = 11.
%C x=1 for k=3*m^2-1 that is A080663, with a = 3*m.
%C From _Wolfdieter Lang_, Apr 26 2014: (Start)
%C The solution of this problem can be found as follows. Consider k*x^2 + (k+1)*x + (k+2) - a^2 = 0. Solve for x (positive) as function of k: x = (-(k+1) + sqrt((2*a)^2*k - c(k)))/(2*k), where c(k) = 3*k(k+2) - 1 is the sequence [8, 23, 44, 71, 104, 143, 188, 239, 296, 359,...]. A necessary condition for a solution is (2*a)^2*k - c(k) = b^2, or k*X^2 - Y^2 = c(k), with X = 2*a and Y = b. This is a binary indefinite quadratic form with discriminant D = (2^2)*k > 0. If k is a square then there is no solution with even X because (K*X)^2 - Y^2 = c(K^2) has only the solution with K=1, X=3, Y=1. For k not a square there are either no solutions for given k (e.g., k = 5, 6, 10, ...) or countable infinitely many ones of the representation k*X^2 - Y^2 = c(k). From the solutions one has to pick first the ones with even X (a = X/2) and then to test whether 2*k divides Y - (k+1). The solution for x is then x = (Y - (k+1))/(2*k).
%C For representations of integers by indefinite binary quadratic forms see, e.g., the D. A. Buell reference, and also a W. Lang link (with further references) with an on-line program.
%C (End)
%D D. A. Buell, Binary Quadratic Forms. Springer-Verlag, NY, 1989.
%H Wolfdieter Lang, <a href="http://www.itp.kit.edu/~wl/BinQuadForm.html">Binary Quadratic Forms (indefinite case)</a>.
%F Increasingly ordered set {a from the positive integers: a^2 = k*x^2 + (k+1)*x + (k+2), with k and x positive integers}. - _Wolfdieter Lang_, Apr 21 2014
%e a(10)=19 from 19^2=361=51*2^2+(51+1)*2+(51+2).
%e From _Wolfdieter Lang_, Apr 21 2014: (Start)
%e k = 2: There are two proper solutions of 2*X^2 - Y^2 = 23, namely [4, 3], [6, 7]. Both generate infinitely many new solutions, all with even X, namely [4, 3], [18, 25], [104, 147], [606, 857],[3532, 4995], [20586, 29113], ... and [6, 7], [32, 45], [186, 263], [1084, 1533],[6318, 8935], [36824, 52077], ... . Only every other solution has 2*k = 4 dividing Y - (2+1) = Y-3, giving the positive solutions for (a=X/2, b=Y; x), starting with the second proper solution and then alternating between the two sets of solutions (3, 7; 1), (52, 147; 36), (93, 263; 65), (1766, 4995; 1248), (3159, 8935; 2233), ... . Thus the positive x solutions for k = 2 are 1, 36, 65, 1248, 2233, ..., with a = 3, 52, 93, 1766, 3159, ... .
%e k = 3: the positive solutions for x are 2, 5, 38, 79, 538, 1109, ..., with a = 5, 10, 67, 138, 933, 1922, ..., coming from the even X solutions of 3*X^2 - Y^2 = 44, [4, 2], [10, 16], [36, 62], [134, 232], [500, 866], [1866, 3232], ... and [6, 8], [20, 34], [74, 128], [276, 478], [1030, 1784], [3844, 6658], ... . Then 2*k = 6 has to divide Y - 4, leaving every other of these solutions with (a = X/2, b=Y; x) given by (5, 16; 2), (10, 34; 5), (67, 232; 38), (138, 478; 79), (933, 3232; 538), (1922, 6658; 1109), ... .
%e k = 5: there are no solutions of 5*X^2 - Y2 = 104.
%e k = 6: there are no solutions of 6*X^2 - Y2 = 143.
%e (End)
%o (BASIC)
%o for k=1 to z
%o for x=1 to z
%o a=k*x*x+(k+1)*x+(k+2)
%o if sqr(a)-int(sqr(a))=0 then
%o j=j+1
%o a_n(j)=sqr(a)
%o endif
%o next x
%o next k
%K nonn
%O 1,1
%A _Carmine Suriano_, Mar 28 2014
%E Edited, name specified, comment changed, reference and link added by _Wolfdieter Lang_, Apr 21 2014