OFFSET
1,1
COMMENTS
An indefinite quadratic form in two variables over the integers, a*x^2 + b*x*y + c*y^2 with discriminant D = b^2 - 4*a*c > 0, 0 or 1 (mod 4) and not a square, is called reduced if b>0 and f(D) - min(|2*a|,|2*c|) <= b < f(D), with f(D) := ceiling(sqrt(D)). See the Scholz-Schoeneberg reference for this definitions.
REFERENCES
A. Scholz and B. Schoeneberg, Einführung in die Zahlentheorie, 5. Aufl., de Gruyter, Berlin, New York, 1973, ch.IV, par.31, p. 112.
LINKS
Robin Visser, Table of n, a(n) for n = 1..10000
Henri Cohen, A Course in Computational Algebraic Number Theory, Grad. Texts in Math., Vol. 138, Springer-Verlag, Berlin, 1993. xii+534 pp. See Definition 5.6.2 on page 257.
FORMULA
a(n)= number of reduced indefinite quadratic forms over the integers for D(n)=A079896(n) (counting also nonprimitive forms).
EXAMPLE
a(1)=2 because there are two reduced forms for D(1)=A079896(1)=5, namely [a,b,c]=[-1, 1, 1] and [1, 1, -1]; here f(5)=3.
a(5)=6: for D(5)=A079896(5)=17 (f(17)=5) the 6 reduced [a,b,c] forms are [[-2, 1, 2], [2, 1, -2], [-2, 3, 1], [-1, 3, 2], [1, 3, -2], [2, 3, -1]]. They are all primitive (that is a,b and c are relatively prime).
a(6)=4: for D(6)=A079896(6)=20 (f(20)=5) there are four reduced forms: [-2, 2, 2], [2, 2, -2], [-1, 4, 1] and [1, 4, -1], Here two of them are nonprimitive, namely [-2, 2, 2], [2, 2, -2].
PROG
(SageMath)
def a(n):
i, D, ans = 1, Integer(5), 0
while(i < n):
D += 1; i += 1*(((D%4) in [0, 1]) and (not D.is_square()))
for b in range(1, isqrt(D)+1):
if ((D-b^2)%4 != 0): continue
for a in Integer((D-b^2)/4).divisors():
if abs(sqrt(D) - 2*a) < b: ans += 1
return 2*ans # Robin Visser, May 31 2025
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wolfdieter Lang, Apr 11 2003
EXTENSIONS
Offset corrected and more terms from Robin Visser, May 31 2025
STATUS
approved
