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-6 of 6 results.

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

Original entry on oeis.org

0, 0, 1, 3, 4, 7, 7, 12, 8, 20, 13, 18, 18, 31, 20, 31, 24, 39, 26, 53, 20, 66, 36, 36, 50, 76, 39, 62, 56, 92, 42, 72, 42, 120, 68, 72, 70, 136, 46, 126, 76, 112, 100, 96, 68, 146, 105, 125, 66, 226, 77, 168, 96, 138, 126, 160, 96, 228, 100, 142
Offset: 1

Views

Author

Barry R. Smith, Apr 16 2015

Keywords

Comments

The number of finite sequences of positive integers with odd 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 even-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=5, the a(5) = 4 Zagier-reduced forms of discriminant 21 are x^2 + 5*x*y + y^2, 5*x^2 + 9*x*y + 3*y^2, 3*x^2 + 9*x*y + 5*y^2, and 5*x^2 + 11*x*y + 5*y^2.
		

References

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

Crossrefs

It appears that this sequence gives half the row sums of the triangle in A264597 (cf. A264598), and also the first column of A264597. - N. J. A. Sloane, Nov 19 2015

Programs

  • Maple
    # Maple code for the formula given by Kleban et al., which is almost certainly the same sequence as this (but until that is proved, the program should not be used to extend this sequence, A264598 or A264599). - N. J. A. Sloane, Nov 19 2015
    with(numtheory); # return number of divisors of m less than b
    dbm:=proc(b,m) local i,t1,t2;
    t1:=divisors(m); t2:=0;
    for i from 1 to nops(t1) do if t1[i]add(dbm(b,b*n-b^2-1), b=1..n-1);
    [seq(f(n),n=1..100)];
  • 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]]}]
  • PARI
    d(n, k) = #select(x->(xMichel Marcus, Apr 18 2023; based on Technau Lemma 3

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.
From the Kleban et al. reference it appears that a(n) = Sum_{b=1..n-1} dbm(b,n*b-b^2-1), where dbm(b,m) = number of positive divisors of m that are less than b. - N. J. A. Sloane, Nov 19 2015

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

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}]

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}]

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}]

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.
Showing 1-6 of 6 results.