A257004 Number of primitive Zagier-reduced indefinite quadratic forms over the integers in two variables with discriminants D(n) = A079896(n).
1, 2, 3, 3, 5, 4, 4, 6, 7, 5, 5, 10, 7, 10, 11, 9, 6, 8, 10, 7, 10, 16, 12, 11, 16, 8, 10, 12, 21, 17, 8, 10, 14, 14, 18, 21, 13, 12, 14, 27, 11, 16, 26, 15, 17, 18, 23, 16, 10, 20, 25, 11, 13, 32, 14, 18, 26, 27, 18, 18, 38, 24, 15, 18, 28
Offset: 1
Keywords
Examples
For D=20, the a(6)=4 Zagier-reduced primitive forms are x^2+6*x*y+4*y^2, 4*x^2+6*x*y+y^2, 4*x^2+10*x*y+5*y^2, and 5*x^2+10*x*y+4*y^2.
References
- D. B. Zagier, Zetafunktionen und quadratische Körper, Springer, 1981. See page 122.
Links
- Robin Visser, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
Table[Length[ Select[Flatten[ Select[ Table[{a, k}, {k, Select[Range[Ceiling[-Sqrt[n]], Floor[Sqrt[n]]], Mod[# - n, 2] == 0 &]}, {a, Select[Divisors[(n - k^2)/4], # > (Sqrt[n] - k)/2 &]}], UnsameQ[#, {}] &], 1], GCD[#[[1]], #[[2]] + 2*#[[1]], #[[1]] + #[[2]] - (n - #[[2]]^2)/(4*#[[1]])] == 1 &]], {n, Select[Range[ 153], ! IntegerQ[Sqrt[#]] && (Mod[#, 4] == 0 || Mod[#, 4] == 1) &]}]
-
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 k in range(-isqrt(D), isqrt(D)+1): if ((D-k^2)%4 != 0): continue for h in Integer((D-k^2)/4).divisors(): if gcd([h, k+2*h, (k+h-(D-k^2)/(4*h))])==1: if h > (sqrt(D)-k)/2: ans += 1 return ans # Robin Visser, Jun 01 2025
Extensions
Offset corrected by Robin Visser, Jun 01 2025
Comments