cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-4 of 4 results.

A082174 Number of primitive reduced indefinite quadratic forms over the integers in two variables with discriminants D(n)=A079896(n).

Original entry on oeis.org

2, 2, 4, 2, 6, 2, 4, 4, 8, 2, 4, 8, 6, 8, 10, 4, 4, 4, 10, 2, 8, 12, 8, 6, 12, 2, 8, 4, 18, 12, 4, 4, 12, 8, 12, 14, 8, 4, 12, 18, 6, 8, 20, 4, 14, 8, 14, 10, 4, 12, 16, 2, 8, 20, 8, 8, 20, 14, 8, 8, 28, 14, 10, 4, 16, 16, 10, 12, 20, 6, 12, 8, 20, 2, 16, 24, 12, 10, 24, 16, 8, 8, 8, 30
Offset: 1

Views

Author

Wolfdieter Lang, Apr 11 2003

Keywords

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)). It is called primitive if gcd(a,b,c)=1 (relative prime). See the Scholz-Schoeneberg reference for these definitions.

Examples

			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.
a(6)=2: 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], but only two of them are primitive, namely [-1, 4, 1] and [1, 4, -1].
		

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 and par.27, p. 97.

Crossrefs

Cf. A082175 (number of reduced forms, nonprimitive forms included).

Programs

  • 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)Robin Visser, May 31 2025

Formula

a(n)= number of primitive reduced indefinite binary quadratic forms over the integers for D(n)=A079896(n).

Extensions

Offset corrected and more terms from Robin Visser, May 31 2025

A257003 Number of Zagier-reduced indefinite quadratic forms over the integers in two variables with discriminants D(n) = A079896(n).

Original entry on oeis.org

1, 2, 3, 3, 5, 5, 4, 6, 7, 5, 7, 10, 7, 10, 11, 9, 7, 11, 13, 7, 10, 16, 12, 11, 16, 13, 10, 14, 21, 17, 8, 15, 18, 14, 18, 21, 13, 12, 20, 27, 11, 16, 26, 18, 17, 25, 23, 21, 13, 20, 25, 12, 20, 32, 24, 18, 26, 27, 18, 18, 38, 31, 15, 18, 33
Offset: 1

Views

Author

Barry R. Smith, Apr 14 2015

Keywords

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 Zagier-reduced if A>0, C>0, and B>A+C.
This definition is from Zagier's 1981 book, and differs from the older and more common notion of reduced form due to Lagrange (see A082175 for this definition).
The number of pairs of integers (h,k) with |k| < sqrt(D), k^2 congruent to D (mod 4), h > (sqrt(D) - k)/2, h exactly dividing (D-k^2)/4, where D=D(n) is the discriminant being considered.

Examples

			For D=20, the pairs (h,k) as above are: (1,4), (2,2), (4,2), (5,0), (4,-2). From these, the a(6)=5 Zagier-reduced forms may be enumerated as h*x^2 + (k+2*h)*x*y + (k+h-(D-k^2)/(4*h))*y^2, yielding x^2+6*x*y+4*y^2, 2*x^2+6*x*y+2*y^2, 4*x^2+10*x*y+5*y^2, 5*x^2+10*x*y+4*y^2, and 4*x^2+6*x*y+y^2.
		

References

  • D. B. Zagier, Zetafunktionen und quadratische Körper, Springer, 1981. See pages 122-123.

Crossrefs

Programs

  • Mathematica
    Table[Length[
      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]], {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 h > (sqrt(D) - k)/2: ans += 1
        return ans  # Robin Visser, Jun 01 2025

Formula

a(n) equals the number of pairs (h,k) with |k| < sqrt(D), k^2 congruent to D (mod 4), h > (sqrt(D) - k)/2, h exactly dividing (D-k^2)/4, where D=D(n) is the discriminant being considered.

Extensions

Offset corrected by Robin Visser, Jun 01 2025

A257004 Number of primitive Zagier-reduced indefinite quadratic forms over the integers in two variables with discriminants D(n) = A079896(n).

Original entry on oeis.org

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

Views

Author

Barry R. Smith, Apr 17 2015

Keywords

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 Zagier-reduced if A>0, C>0, and B>A+C.
This definition is from Zagier's 1981 book, and differs from the older and more common notion of reduced form due to Lagrange (see A082175 for this definition).
A form is primitive if its coefficients are relatively prime.

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.

Crossrefs

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

A006375 Number of equivalence classes of cycles (or periods) of reduced indefinite binary quadratic forms of determinant -n (see comments).

Original entry on oeis.org

2, 1, 1, 3, 2, 1, 1, 2, 4, 2, 1, 2, 2, 1, 2, 5, 2, 2, 1, 3, 2, 1, 1, 3, 6, 2, 2, 2, 2, 2, 1, 3, 2, 2, 2, 7, 3, 1, 2, 4, 2, 2, 1, 2, 4, 1, 1, 4, 6, 3, 2, 3, 2, 2, 2, 3, 2, 2, 1, 4, 2, 1, 3, 8, 4, 2, 1, 3, 2, 2, 1, 5, 2, 2, 3, 2, 2, 2, 2, 5, 8, 3, 1, 4, 4, 1, 2, 3, 2, 4, 2, 2, 2, 1, 2, 5
Offset: 1

Views

Author

Keywords

Comments

From Robin Visser, Jun 05 2025: (Start)
Let a (classically integral) binary quadratic form f(x,y) = a*x^2 + 2*b*x*y + c*y^2 of determinant -n = a*c-b^2 (or equivalently, of discriminant 4*n = 4*(b^2 - a*c)) be denoted as the triple [a,b,c]. If n is not a square, then we can define a sequence of binary quadratic forms [a_0, b_0, c_0], [a_1, b_1, c_1], [a_2, b_2, c_2], ... by the following recursive definition: Let [a_0, b_0, c_0] = [a, b, c], and for each i >= 0, let [a_{i+1}, b_{i+1}, c_{i+1}] = [c_i, t, (t^2 - n)/c_i] where t is the largest integer such that t = -b_i (mod c_i) and t^2 < n, if such an integer t exists. Otherwise t is the smallest integer (in absolute value) which satisfies t = -b_i (mod c_i), taking t positive in the case of a tie (see Conway--Sloane pg 357).
Gauss showed that such sequences are eventually periodic, and we denote the cycle of f(x,y) as the set of all forms in the period of this sequence (see also A087048 for a similar definition of cycle). If n is a square, then this sequence terminates in a form [a_k, b_k, 0], and the definition must be modified slightly (see Conway--Sloane pg 359). Two binary quadratic forms f(x,y) and g(x,y) are said to be properly equivalent if they have the same cycle.
This sequence a(n) counts equivalence classes of such cycles of indefinite binary quadratic forms f(x,y) of determinant -n, with respect to a somewhat coarser notion of equivalence than proper equivalence; here the binary forms [a, b, c], [-a, b, -c], [c, b, a], and [-c, b, -a] are all counted as part of the same equivalence class. (End)

Examples

			From _Robin Visser_, Jun 08 2025: (Start)
For n = 1, every indefinite binary quadratic form of determinant -1 (equivalently discriminant 4) is equivalent to either 2*x*y - y^2 or 2*x*y, thus a(1) = 2.
For n = 2, every indefinite binary quadratic form of determinant -2 (equivalently discriminant 8) is equivalent to x^2 + 2*x*y - y^2, thus a(2) = 1.
For n = 3, every indefinite binary quadratic form of determinant -3 (equivalently discriminant 12) is equivalent to x^2 + 2*x*y - 2*y^2, thus a(3) = 1.
For n = 4, every indefinite binary quadratic form of determinant -4 (equivalently discriminant 16) is equivalent to either x^2 + 2*x*y - 3*y^2, 4*x*y - 2*y^2, or 4*x*y, thus a(4) = 3. (End)
		

References

  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 362.
  • C. F. Gauss, Disquisitiones arithmeticae, Yale University Press, New Haven, Conn.-London, 1966.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • SageMath
    def a(n):
        S = []
        for b in range(1, ceil(sqrt(n))):
            for a in Integer(n-b^2).divisors():
                c = (b^2-n)/a
                F = [BinaryQF(x,2*b,y) for (x,y) in [(a,c),(-a,-c),(c,a),(-c,-a)]]
                if all([(not Q.is_equivalent(t)) for t in S for Q in F]): S.append(F[0])
        if Integer(n).is_square():
            for c in range(-sqrt(n), sqrt(n)+1):
                F = [BinaryQF(x,2*sqrt(n),y) for (x,y) in [(0,c),(0,-c),(c,0),(-c,0)]]
                if all([(not Q.is_equivalent(t)) for t in S for Q in F]): S.append(F[0])
        return len(S)  # Robin Visser, Jun 06 2025

Extensions

Corrected Apr 15 1995
Name clarified by Robin Visser, May 30 2025
Term a(65) corrected and more terms from Robin Visser, Jun 06 2025
Showing 1-4 of 4 results.