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.

User: Barry R. Smith

Barry R. Smith's wiki page.

Barry R. Smith has authored 13 sequences. Here are the ten most recent ones:

A257006 Irregular triangle read by rows: period lengths of periods of primitive Zagier-reduced binary quadratic forms with discriminants D(n) = A079896(n).

Original entry on oeis.org

1, 2, 2, 1, 3, 5, 4, 3, 1, 4, 2, 5, 2, 5, 4, 1, 6, 4, 7, 6, 4, 11, 6, 3, 5, 1, 6, 2, 10, 7, 8, 2, 9, 7, 6, 3, 2, 1, 11, 9, 7, 8, 8, 2, 8, 4, 21, 10, 7, 7, 1, 8, 2, 10, 4, 9, 5, 12, 6
Offset: 1

Author

Barry R. Smith, Apr 20 2015

Keywords

Comments

The possible positive nonsquare discriminants of binary quadratic forms are given in A079896.
For the definition of Zagier-reduced binary quadratic forms, see A257003.
A form is primitive if its coefficients are relatively prime.
The row sums give A257004(n), the number of primitive Zagier-reduced forms of discriminant D(n).
The number of entries in row n is A087048(n), the class number of primitive forms of discriminant D(n).

Examples

			The table a(n,k) begins:
n/k  1   2   ...   D(n)    A087048(n)   A257004(n)
1:   1               5        1             1
2:   2               8        1             2
3:   2   1          12        2             3
4:   3              13        1             3
5:   5              17        1             5
6:   4              20        1             4
7:   3   1          21        2             4
8:   4   2          24        2             6
9:   5   2          28        2             7
10:  5              29        1             5
11:  4   1          32        2             5
12:  6   4          33        2            10
13:  7              37        1             7
14:  6   4          40        2            10
15: 11              41        1            11
16:  6   3          44        2             9
17:  5   1          45        2             6
18:  6   2          48        2             8
19: 10              52        1            10
		

References

  • D. B. Zagier, Zetafunktionen und quadratische Körper, Springer, 1981.

Crossrefs

Formula

a(n,k), n >= 1, k = 1, 2, ..., A079896(n), is the length of the k-th period of the primitive Zagier-reduced forms of discriminant D(n) = A079896(n). The lengths in row n are organized in nonincreasing order.

Extensions

Offset corrected by Robin Visser, Jun 08 2025

A257013 Number of sequences of positive integers with length 6 and alternant equal to n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 5, 0, 4, 4, 9, 0, 12, 1, 13, 10, 8, 4, 33, 4, 14, 12, 21, 4, 44, 2, 33, 22, 24, 12, 62, 8, 16, 29, 63, 2, 64, 4, 57, 52, 26, 10, 111, 21, 40, 48, 45, 8, 106, 26, 94, 40, 46, 18, 164, 21, 40, 61, 97, 40, 118, 12, 87, 65, 104, 14, 221, 14, 52, 116, 88, 30, 146, 21, 157
Offset: 1

Author

Barry R. Smith, Apr 19 2015

Keywords

Comments

See A257009 for the definition of the alternant of a sequence. The number of sequences of length 1 with given alternant value n is 1, while the number of sequences of length 2 with given alternant value n is d(n), the number of divisors of n (see A000005).

Examples

			For n=14, the a(14)=4 sequences with alternant 14 and length 6 are (1,1,1,1,4,1), (1,2,1,1,3,1), (1,3,1,1,2,1), and (1,4,1,1,1,1).
		

Programs

  • Mathematica
    Length6Q[x_, y_] :=
     Module[{l = ContinuedFraction[(x[[2]] + 2*x[[1]] + y)/(2*x[[1]])]},
      If[EvenQ[Length[l]], Return[Length[l] == 6],
       If[Last[l] == 1, Return[Length[l] - 1 == 6], Return[Length[l] + 1 == 6]]]]
    Table[Length[
      Select[Flatten[
        Select[
         Table[{a, k}, {k,
           Select[Range[Ceiling[-Sqrt[n^2 + 4]], Floor[Sqrt[n^2 + 4]]],
            Mod[# - n^2 - 4, 2] == 0 &]}, {a,
           Select[Divisors[(n^2 + 4 - k^2)/4], # > (Sqrt[n^2 + 4] - k)/2 &]}],
         UnsameQ[#, {}] &], 1], Length6Q[#, n] &]], {n, 1, 80}]

A257012 Number of sequences of positive integers with length 5 and alternant equal to n.

Original entry on oeis.org

0, 0, 1, 2, 3, 5, 5, 10, 8, 11, 11, 19, 15, 19, 17, 27, 17, 36, 17, 43, 27, 29, 31, 54, 30, 41, 45, 63, 29, 57, 33, 75, 49, 59, 47, 96, 39, 79, 57, 84, 61, 81, 49, 97, 81, 85, 47, 150, 64, 105, 75, 101, 69, 123, 77, 141, 81, 103, 71, 189, 75, 119, 121, 137, 82, 143, 85, 183, 101, 129, 93, 211, 89, 129, 131, 187, 116, 201
Offset: 1

Author

Barry R. Smith, Apr 19 2015

Keywords

Comments

See A257009 for the definition of the alternant of a sequence. The number of sequences of length 1 with given alternant value n is 1, while the number of sequences of length 2 with given alternant value n is d(n), the number of divisors of n (see A000005).

Examples

			The a(7) = 3 sequences with length 5 and alternant 7 are (1,1,1,3,1), (1,2,1,2,1), and (1,3,1,1,1).
		

Programs

  • Mathematica
    Length5Q[x_, y_] :=
     Module[{l = ContinuedFraction[(x[[2]] + 2*x[[1]] + y)/(2*x[[1]])]},
      If[OddQ[Length[l]], Return[Length[l] == 5],
       If[Last[l] == 1, Return[Length[l] - 1 == 5], Return[Length[l] + 1 == 5]]]];
    Table[Length[
      Select[Flatten[
        Select[
         Table[{a, k}, {k,
           Select[Range[Ceiling[-Sqrt[n^2 - 4]], Floor[Sqrt[n^2 - 4]]],
            Mod[# - n^2 + 4, 2] == 0 &]}, {a,
           Select[Divisors[(n^2 - 4 - k^2)/4], # > (Sqrt[n^2 - 4] - k)/2 &]}],
         UnsameQ[#, {}] &], 1], Length5Q[#, n] &]], {n, 3, 80}]

A257005 Irregular triangle read by rows: period lengths of periods of Zagier-reduced binary quadratic forms with discriminants D(n) = A079896(n).

Original entry on oeis.org

1, 2, 2, 1, 3, 5, 4, 1, 3, 1, 4, 2, 5, 2, 5, 4, 2, 1, 6, 4, 7, 6, 4, 11, 6, 3, 5, 1, 1, 6, 2, 2, 1, 10, 3, 7, 8, 2, 9, 7, 6, 3, 2, 1, 11, 9, 7, 8, 5, 8, 2, 8, 4, 2, 21, 10, 7, 7, 1, 8, 4, 2, 1, 10, 4, 3, 1, 9, 5, 12, 6
Offset: 1

Author

Barry R. Smith, Apr 19 2015

Keywords

Comments

The possible positive nonsquare discriminants of binary quadratic forms are given in A079896.
For the definition of Zagier-reduced binary quadratic forms, see A257003.
The row sums give A257003(n), the number of Zagier-reduced forms of discriminant D(n).
The number of entries in row n is A256945(n), the class number of primitive forms of discriminant D(n).

Examples

			The table a(n,k) begins:
n/k  1   2   3   4  ...   D(n)    A256945(n)   A257003(n)
1:   1                      5        1             1
2:   2                      8        1             2
3:   2   1                 12        2             3
4:   3                     13        1             3
5:   5                     17        1             5
6:   4   1                 20        2             5
7:   3   1                 21        2             4
8:   4   2                 24        2             6
9:   5   2                 28        2             7
10:  5                     29        1             5
11:  4   2   1             32        3             7
12:  6   4                 33        2            10
13:  7                     37        1             7
14:  6   4                 40        2            10
15: 11                     41        1            11
16:  6   3                 44        2             9
17:  5   1   1             45        3             7
18:  6   2   2   1         48        4            11
19: 10   3                 52        2            13
		

References

  • D. B. Zagier, Zetafunktionen und quadratische Körper, Springer, 1981.

Crossrefs

Formula

a(n,k), n >= 1, k = 1, 2, ..., A256945(n), is the length of the k-th period of the Zagier-reduced forms for discriminant D(n) = A079896(n). The lengths in row n are organized in nonincreasing order.

Extensions

Offset corrected by Robin Visser, Jun 08 2025

A256945 Number of periods of reduced indefinite binary quadratic forms with discriminant D(n) = A079896(n).

Original entry on oeis.org

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

Author

Barry R. Smith, Apr 19 2015

Keywords

Comments

This is an ``imprimitive'' class number. Each a(n) is A087048(n) increased by the number of cycles of discriminant D(n) of imprimitive binary quadratic forms.
The gcd of the coefficients is the same for each form within a cycle, so is a cycle invariant. There will exist cycles with gcd invariant equal to k precisely when D(n)/k^2 = A079896(m) for some m. In this case, the number of such cycles is A087048(m).

Examples

			a(6) gives the number of cycles of reduced indefinite forms of discriminant D(6) = 20.  This is the sum A087048(1) + A087048(6) = 2.
		

References

  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, 3rd. ed. See Section 3.3 on page 359.

Crossrefs

Programs

  • SageMath
    def a(n):
        i, D, S = 1, Integer(5), []
        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():
                Q = BinaryQF(a, b, -(D-b^2)/(4*a))
                if all([(not Q.is_equivalent(t)) for t in S]): S.append(Q)
        return len(S)  # Robin Visser, May 31 2025

Formula

a(n) is the sum A087048(m) over all integers m with D(m)= D(n)/k^2 for some integer k.

Extensions

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

A257161 The length of the period under Zagier-reduction of the principal indefinite quadratic binary form of discriminant D(n) = A079896(n).

Original entry on oeis.org

1, 2, 1, 3, 5, 4, 1, 2, 2, 5, 1, 4, 7, 6, 11, 3, 1, 2, 10, 7, 2, 7, 1, 11, 9, 8, 2, 4, 21, 7, 1, 2, 4, 9, 6, 21, 2, 3, 1, 27, 11, 10, 3, 5, 17, 6, 23, 16, 1, 2, 8, 11, 2, 15, 2, 6, 2, 27, 1
Offset: 1

Author

Barry R. Smith, Apr 16 2015

Keywords

Comments

A binary quadratic form A*x^2 + B*x*y + C*y^2 with integer coefficients A, B, and C and positive discriminant D = B^2 - 4*A*C is Zagier-reduced if A>0, C>0, and B>A+C. (This differs from the classical reduced forms defined by Lagrange.) There are finitely many Zagier-reduced forms of given discriminant.
Zagier defines a reduction operation on binary quadratic forms with positive discriminants, which permutes the reduced forms. The reduced forms are thereby partitioned into disjoint cycles.
There is a unique Zagier-reduced form with A=1 for each discriminant in A079896. The cycle containing this form is the principal cycle. a(n) is the length of this cycle for the discriminant D=A079896(n).

Examples

			For n=4, the a(4) = 3 forms in the principal cycle of discriminant A079896(4) = 13 are x^2 + 5*x*y + 3*y^2, 3*x^2 + 5*x*y + y^2, and 3*x^2 + 7*x*y + 3*y^2.
		

References

  • D. B. Zagier, Zetafunktionen und quadratische Korper, Springer, 1981.

Crossrefs

Cf. A226166.

Formula

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

Extensions

Offset corrected by Robin Visser, Jun 08 2025

A257011 Number of sequences of positive integers with length 4 and alternant equal to n.

Original entry on oeis.org

0, 0, 1, 2, 3, 6, 5, 8, 11, 10, 10, 20, 11, 16, 21, 24, 15, 26, 23, 28, 31, 22, 24, 49, 27, 36, 33, 36, 33, 52, 33, 46, 51, 42, 41, 64, 41, 38, 54, 74, 43, 64, 44, 66, 63, 56, 57, 88, 59, 58, 79, 60, 52, 96, 61, 92, 69, 68, 72, 110
Offset: 1

Author

Barry R. Smith, Apr 18 2015

Keywords

Comments

See A257009 for the definition of the alternant of a sequence. The number of sequences of length 1 with given alternant value n is 1, while the number of sequences of length 2 with given alternant value n is d(n), the number of divisors of n (see A000005).

Examples

			For n=5, the a(5)=3 sequences with alternant 5 and length 4 are (1,3,1,1), (1,2,2,1), and (1,1,3,1).
		

Programs

  • Mathematica
    Length4Q[x_, y_] :=
    Module[{l = ContinuedFraction[(x[[2]] + 2*x[[1]] + y)/(2*x[[1]])]},
      If[EvenQ[Length[l]], Return[Length[l] == 4],
       If[Last[l] == 1, Return[Length[l] - 1 == 4], Return[Length[l] + 1 == 4]]]];
    Table[Length[
      Select[Flatten[
        Select[
         Table[{a, k}, {k,
           Select[Range[Ceiling[-Sqrt[n^2 + 4]], Floor[Sqrt[n^2 + 4]]],
            Mod[# - n^2 - 4, 2] == 0 &]}, {a,
           Select[Divisors[(n^2 + 4 - k^2)/4], # > (Sqrt[n^2 + 4] - k)/2 &]}],
         UnsameQ[#, {}] &], 1], Length4Q[#, n] &]], {n, 1, 60}]

A257010 Number of sequences of positive integers with length 3 and alternant equal to n.

Original entry on oeis.org

0, 2, 2, 4, 3, 6, 2, 9, 4, 6, 5, 11, 4, 9, 6, 10, 5, 14, 2, 16, 7, 6, 9, 16, 6, 11, 8, 17, 5, 14, 4, 20, 10, 8, 9, 22, 2, 17, 10, 16, 11, 14, 6, 18, 13, 12, 5, 28, 6, 19, 9, 15, 13, 16, 8, 24, 6, 12, 11, 32, 6, 15, 16, 16, 9, 19, 8, 30, 8, 14, 9, 30, 8, 15, 12, 21, 16, 22
Offset: 3

Author

Barry R. Smith, Apr 18 2015

Keywords

Comments

See A257009 for the definition of the alternant of a sequence. The number of sequences of length 1 with given alternant value n is 1, while the number of sequences of length 2 with given alternant value n is d(n), the number of divisors of n (see A000005).
There are infinitely many sequences of length 3 and alternant equal to 2. It is for this reason that the offset is 3.

Examples

			For n=6, the a(6) = 4 sequences with alternant 6 are (1,1,3), (1,3,2), (2,3,1), (3,1,1)
		

Programs

  • Maple
    Dbm:= proc(b,m) nops(select(t -> (t-1) mod b = 0, numtheory:-divisors(m))) end proc:
    seq(add(Dbm(b,b^2+n*b+1)-2, b=1..n-1), n=3..100); # Robert Israel, Jan 24 2016
  • Mathematica
    Length3Q[x_, y_] :=
    Module[{l = ContinuedFraction[(x[[2]] + 2*x[[1]] + y)/(2*x[[1]])]},
      If[OddQ[Length[l]], Return[Length[l] == 3],
       If[Last[l] == 1, Return[Length[l] - 1 == 3], Return[Length[l] + 1 == 3]]]];
    Table[Length[
      Select[Flatten[
        Select[
         Table[{a, k}, {k,
           Select[Range[Ceiling[-Sqrt[n^2 - 4]], Floor[Sqrt[n^2 - 4]]],
            Mod[# - n^2 + 4, 2] == 0 &]}, {a,
           Select[Divisors[(n^2 - 4 - k^2)/4], # > (Sqrt[n^2 - 4] - k)/2 &]}],
         UnsameQ[#, {}] &], 1], Length3Q[#, n] &]], {n, 3, 60}]
  • PARI
    a(n)={sum(b=1, n-1, sumdiv(b^2+n*b+1, d, (d-1)%b==0) - 2)} \\ Andrew Howroyd, May 01 2020

Formula

a(n) = Sum_{b=1..n-1} (Dbm (b,b^2+nb+1)-2), where Dbm(b,m) is the number of positive divisors of m that are congruent to 1 modulo b. - Barry R. Smith, Jan 24 2016

Extensions

Terms a(61) and beyond from Andrew Howroyd, May 01 2020

A257009 Number of finite sequences of positive integers with alternant equal to n.

Original entry on oeis.org

4, 8, 9, 17, 14, 25, 22, 36, 25, 49, 31, 55, 49, 69, 41, 83, 52, 100, 66, 100, 66, 126, 84, 132, 88, 125, 95, 198, 82, 159, 119, 190, 125, 211, 125, 194, 135, 275, 128, 250, 152, 232, 191, 238, 174, 348, 150, 330, 223, 279, 158, 356, 220, 374, 217, 360, 196, 438
Offset: 3

Author

Barry R. Smith, Apr 16 2015

Keywords

Comments

The alternant of a sequence of positive integers (c_1, ..., c_r) with r>=3 is the positive integer [c_1, ..., c_r] - [c_2, ..., c_{r-1}], in which an expression in brackets denotes the numerator of the simplified rational number with continued fraction expansion having the sequence of quotients in brackets. The alternant of (c_1) is c_1 and the alternant of (c_1, c_2) is c_1*c_2. There are finitely many sequences with given alternant >= 3. (There are infinitely many sequences with alternant 2 -- (2), (1,2), (2,1), and all sequences of the form (1,p,1). It is for this reason that the offset is 3.)
The number of Zagier-reduced binary quadratic forms with discriminant equal to n^2-4 or n^2+4
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=n^2+4 or n^2-4.
a(n) = A257007(n) + A257008(n)

References

  • D. B. Zagier, Zetafunktionen und quadratische Korper, Springer, 1981.

Crossrefs

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 = n^2-4 or n^2+4.

A257008 Number of Zagier-reduced binary quadratic forms of discriminant n^2+4.

Original entry on oeis.org

1, 2, 3, 5, 5, 10, 7, 13, 14, 16, 12, 31, 13, 24, 29, 38, 17, 44, 26, 47, 46, 34, 30, 90, 34, 56, 49, 63, 39, 106, 40, 87, 77, 70, 57, 139, 55, 58, 89, 149, 52, 138, 52, 136, 123, 92, 69, 223, 84, 104, 146, 111, 62, 218, 94, 214, 121, 132, 96, 296
Offset: 1

Author

Barry R. Smith, Apr 16 2015

Keywords

Comments

The number of finite sequences of positive integers with even length parity and alternant equal to n.
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=n^2+4.
The number of possible asymmetry types for the quotient sequence of the odd-length continued fraction expansion of a rational number a/b, where b satisfies one of the congruences b^2 + nb - 1 = 0 (mod a) or b^2 - nb - 1 = 0 (mod a)

Examples

			For n=4, the a(4) = 5 Zagier-reduced forms of discriminant 20 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, 5*x^2 + 10*x*y + 4*y^2, and 2*x^2 + 6*x*y + 2*y^2
		

References

  • D. B. Zagier, Zetafunktionen und quadratische Korper, Springer, 1981.

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, Map[#^2 + 4 &, Range[3, 60]]}]

Formula

With D=n^2+4, 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.