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

A198060 Array read by antidiagonals, m>=0, n>=0, A(m,n) = Sum_{k=0..n} Sum_{j=0..m} Sum_{i=0..m} (-1)^(j+i)*C(i,j)*C(n,k)^(m+1)*(n+1)^j*(k+1)^(-j).

Original entry on oeis.org

1, 1, 2, 1, 3, 4, 1, 4, 10, 8, 1, 5, 22, 35, 16, 1, 6, 46, 134, 126, 32, 1, 7, 94, 485, 866, 462, 64, 1, 8, 190, 1700, 5626, 5812, 1716, 128, 1, 9, 382, 5831, 35466, 69062, 40048, 6435, 256, 1, 10, 766, 19682, 219626, 795312, 882540, 281374, 24310, 512
Offset: 0

Views

Author

Peter Luschny, Nov 01 2011

Keywords

Comments

We repeat the definition of a meander as given in the link below and used in the sequences in the cross-references:
A binary curve C is a triple (m, S, dir) such that:
(a) S is a list with values in {L, R} which starts with an L,
(b) dir is a list of m different values, each value of S being allocated a value of dir,
(c) consecutive Ls increment the index of dir,
(d) consecutive Rs decrement the index of dir,
(e) the integer m > 0 divides the length of S.
(f) C is a meander if each value of dir occurs length(S) / m times.
The rows of the array A(m, n) show the number of meanders of length n and central angle 360/m as specified by the columns of a table in the given link. - Peter Luschny, Mar 20 2023

Examples

			Array A(m, k) starts:
  m\n  [0] [1]  [2]   [3]     [4]     [5]        [6]
  --------------------------------------------------
  [0]   1   2    4     8      16       32         64   A000079
  [1]   1   3   10    35     126      462       1716   A001700
  [2]   1   4   22   134     866     5812      40048   A197657
  [3]   1   5   46   485    5626    69062     882540   A198256
  [4]   1   6   94  1700   35466   795312   18848992   A198257
  [5]   1   7  190  5831  219626  8976562  394800204   A198258
Triangle T(m, k) starts:
  [0]   1;
  [1]   2,    1;
  [2]   4,    3,    1;
  [3]   8,   10,    4,    1;
  [4]  16,   35,   22,    5,    1;
  [5]  32,  126,  134,   46,    6,   1;
  [6]  64,  462,  866,  485,   94,   7, 1;
  [7] 128, 1716, 5812, 5626, 1700, 190, 8, 1;
Using the representation of meanders as multiset permutations (see A361043) and generated by the Julia program below.
  T(3, 0) =  8 = card(1000, 1100, 1010, 1001, 1110, 1101, 1011, 1111).
  T(3, 1) = 10 = card(110000, 100100, 100001, 111100, 111001, 110110, 110011, 101101, 100111, 111111).
  T(3, 2) =  4 = card(111000, 110001, 100011, 111111).
  T(3, 3) =  1 = card(1111).
		

Crossrefs

Programs

  • Julia
    using Combinatorics
    function isMeander(m::Int, c::Vector{Bool})::Bool
        l = length(c)
        (l == 0 || c[1] != true) && return false
        vec = fill(Int(0), m)
        max = div(l, m)
        dir = Int(1)
        ob = c[1]
        for b in c
            if b && ob
                dir += 1
            elseif !b && !ob
                dir -= 1
            end
            dir = mod(dir, m)
            v = vec[dir + 1] + 1
            vec[dir + 1] = v
            if v > max
                return false
            end
            ob = b
        end
    true end
    function CountMeanders(n, k)
        n == 0 && return k + 1
        count = 0
        size = n * k
        for a in range(0, stop=size; step=n)
            S = [(i <= a) for i in 1:size]
            count += sum(1 for c in multiset_permutations(S, size)
                         if isMeander(n, c); init = 0)
        end
    count end
    A198060ByCount(m, n) = CountMeanders(m + 1, n + 1)
    for n in 0:4
        [A198060ByCount(n, k) for k in 0:4] |> println
    end
    # Peter Luschny, Mar 20 2023
  • Maple
    A198060 := proc(m, n) local i, j, k; add(add(add((-1)^(j+i)*binomial(i, j)* binomial(n, k)^(m+1)*(n+1)^j*(k+1)^(-j), i=0..m), j=0..m), k=0..n) end:
    for m from 0 to 6 do seq(A198060(m, n), n=0..6) od;
  • Mathematica
    a[m_, n_] := Sum[ Sum[ Sum[(-1)^(j + i)*Binomial[i, j]*Binomial[n, k]^(m+1)*(n+1)^j*(k+1)^(m-j)/(k+1)^m, {i, 0, m}], {j, 0, m}], {k, 0, n}]; Table[ a[m-n, n], {m, 0, 9}, {n, 0, m}] // Flatten (* Jean-François Alcover, Jun 27 2013 *)
  • SageMath
    # This function assumes an offset (1, 1).
    def A(m: int, n: int) -> int:
        S = sum(
                sum(
                    sum((
                        (-1) ** (j + i)
                        * binomial(i, j)
                        * binomial(n - 1, k) ** m
                        * n ** j )
                        // (k + 1) ** j
                    for i in range(m) )
                for j in range(m) )
            for k in range(n) )
        return S
    def Arow(n: int, size: int) -> list[int]:
        return [A(n, k) for k in range(1, size + 1)]
    for n in range(1, 7): print([n], Arow(n, 7)) # Peter Luschny, Mar 24 2023
    # These functions compute the number of meanders by generating and counting.
    # Their primary purpose is to illustrate that meanders are a special class of
    # multiset permutations. They are not suitable for numerical calculation.
    

Formula

From Peter Bala, Apr 22 2022: (Start)
Conjectures:
1) the m-th row entries satisfy the Gauss congruences T(m, n*p^r - 1) == T(m, n*p^(r-1) - 1) (mod p^r) for primes p >= 3 and positive integers n and r.
2) for m even, the m-th row entries satisfy the congruences T(m, p^r - 1) == 2^(p^r - 1) (mod p^2) for primes p >= 3 and positive integers r.
3) for m odd, the m-th row entries satisfy the supercongruences T(m,n*p^r - 1) == T(m,n*p*(r-1) - 1) (mod p^(3*r)) for primes p >= 5 and positive integers n and r. (End)

A361682 Array read by descending antidiagonals. A(n, k) is the number of multiset combinations of {0, 1} whose type is defined in the comments. Also A(n, k) = hypergeom([-k, -2], [1], n).

Original entry on oeis.org

1, 1, 1, 1, 3, 1, 1, 6, 5, 1, 1, 10, 13, 7, 1, 1, 15, 25, 22, 9, 1, 1, 21, 41, 46, 33, 11, 1, 1, 28, 61, 79, 73, 46, 13, 1, 1, 36, 85, 121, 129, 106, 61, 15, 1, 1, 45, 113, 172, 201, 191, 145, 78, 17, 1, 1, 55, 145, 232, 289, 301, 265, 190, 97, 19, 1
Offset: 0

Views

Author

Peter Luschny, Mar 21 2023

Keywords

Comments

A combination of a multiset M is an unordered selection of k objects of M, where every object can appear at most as many times as it appears in M.
A(n, k) = Cardinality(Union_{j=0..k} Combination(MultiSet(1^[j*n], 0^[(k-j)*n]))), where MultiSet(r^[s], u^[v]) denotes a set that contains the element r with multiplicity s and the element u with multiplicity v; thus the multisets under consideration have n*k elements. Since the base set is {1, 0} the elements can be represented as binary strings. Applying the combination operator to the multisets results in a set of binary strings where '0' resp. '1' can appear at most j*n resp. (k-j)*n times. 'At most' means that they do not have to appear; in other words, the resulting set always includes the empty string ''.
In contrast to the procedure in A361045 we consider here the cardinality of the set union and not the sum of the individual cardinalities. If you want to exclude the empty string, you will find the sequences listed in A361521. The same construction with multiset permutations instead of multiset combinations results in A361043.
A different view can be taken if one considers the hypergeometric representation, hypergeom([-k, -m], [1], n). This is a family of arrays that includes the 'rascal' triangle: the all 1's array A000012 (m = 0), the rascal array A077028 (m = 1), this array (m = 2), and A361731 (m = 3).

Examples

			Array A(n, k) starts:
   [0] 1,  1,   1,    1,   1,   1,   1,    1, ...  A000012
   [1] 1,  3,   6,   10,  15,  21,  28,   36, ...  A000217
   [2] 1,  5,  13,   25,  41,  61,  85,  113, ...  A001844
   [3] 1,  7,  22,   46,  79, 121, 172,  232, ...  A038764
   [4] 1,  9,  33,   73, 129, 201, 289,  393, ...  A081585
   [5] 1, 11,  46,  106, 191, 301, 436,  596, ...  A081587
   [6] 1, 13,  61,  145, 265, 421, 613,  841, ...  A081589
   [7] 1, 15,  78,  190, 351, 561, 820, 1128, ...  A081591
   000012  | A028872 | A239325 |
       A005408    A100536   A069133
.
Triangle T(n, k) starts:
   [0] 1;
   [1] 1,  1;
   [2] 1,  3,   1;
   [3] 1,  6,   5,   1;
   [4] 1, 10,  13,   7,   1;
   [5] 1, 15,  25,  22,   9,   1;
   [6] 1, 21,  41,  46,  33,  11,   1;
   [7] 1, 28,  61,  79,  73,  46,  13,  1;
   [8] 1, 36,  85, 121, 129, 106,  61, 15,  1;
   [9] 1, 45, 113, 172, 201, 191, 145, 78, 17, 1.
.
Row 4 of the triangle:
A(0, 4) =  1 = card('').
A(1, 3) = 10 = card('', 0, 00, 000, 1, 10, 100, 11, 110, 111).
A(2, 2) = 13 = card('', 0, 00, 000, 0000, 1, 10, 100, 11, 110, 1100, 111, 1111).
A(3, 1) =  7 = card('', 0, 00, 000, 1, 11, 111).
A(4, 0) =  1 = card('').
		

Crossrefs

Cf. A239592 (main diagonal), A239331 (transposed array).

Programs

  • Maple
    A := (n, k) -> 1 + n*k*(4 + n*(k - 1))/2:
    for n from 0 to 7 do seq(A(n, k), k = 0..7) od;
    # Alternative:
    ogf := n -> (1 + (n - 1)*x)^2 / (1 - x)^3:
    ser := n -> series(ogf(n), x, 12):
    row := n -> seq(coeff(ser(n), x, k), k = 0..9):
    seq(print(row(n)), n = 0..7);
  • SageMath
    def A(m: int, steps: int) -> int:
        if m == 0: return 1
        size = m * steps
        cset = set()
        for a in range(0, size + 1, m):
            S = [str(int(i < a)) for i in range(size)]
            C = Combinations(S)
            cset.update("".join(i for i in c) for c in C)
        return len(cset)
    def ARow(n: int, size: int) -> list[int]:
        return [A(n, k) for k in range(size + 1)]
    for n in range(8): print(ARow(n, 7))

Formula

A(n, k) = 1 + n*k*(4 + n*(k - 1))/2.
T(n, k) = 1 + k*(n - k)*(4 + k*(n - k - 1))/2.
A(n, k) = [x^k] (1 + (n - 1)*x)^2 / (1 - x)^3.
A(n, k) = hypergeom([-k, -2], [1], n).
A(n, k) = A361521(n, k) + 1.

A361045 Array read by descending antidiagonals. A(n, k) is, if n > 0, the number of multiset combinations of {0, 1} whose type is defined in the comments. A(0, k) = k + 1.

Original entry on oeis.org

1, 2, 1, 3, 4, 1, 4, 10, 6, 1, 5, 20, 19, 8, 1, 6, 35, 44, 30, 10, 1, 7, 56, 85, 76, 43, 12, 1, 8, 84, 146, 155, 116, 58, 14, 1, 9, 120, 231, 276, 245, 164, 75, 16, 1, 10, 165, 344, 448, 446, 355, 220, 94, 18, 1, 11, 220, 489, 680, 735, 656, 485, 284, 115, 20, 1
Offset: 0

Views

Author

Peter Luschny, Mar 21 2023

Keywords

Comments

A combination of a multiset M is an unordered selection of k objects of M, where every object can appear at most as many times as it appears in M.
A(n, k) = Sum_{j=0..k} Cardinality(Combination(MultiSet(1^[j*n], 0^[(k-j)*n]))), where MultiSet(r^[s], u^[v]) denotes a set that contains the element r with multiplicity s and the element u with multiplicity v; thus the multisets under consideration have n*k elements. Since the base set is {1, 0} the elements can be represented as binary strings. Applying the combination operator to the multisets results in a set of binary strings where '0' resp. '1' can appear at most j*n resp. (k-j)*n times. 'At most' means that they do not have to appear; in other words, the resulting set always includes the empty string ''.
This construction is the counterpart of A361043, generated by substituting 'Permutations' with 'Combinations' in the formulas (resp. programs). But since the resulting sets are not disjoint, this leads to multiple counting of some elements. If this is not desired, one can choose the variant described in A361682.

Examples

			Array A(n, k) starts:
[0] 1,  2,  3,   4,   5,   6,    7,    8,    9,   10, ...  A000027
[1] 1,  4, 10,  20,  35,  56,   84,  120,  165,  220, ...  A000292
[2] 1,  6, 19,  44,  85, 146,  231,  344,  489,  670, ...  A005900
[3] 1,  8, 30,  76, 155, 276,  448,  680,  981, 1360, ...  A100175
[4] 1, 10, 43, 116, 245, 446,  735, 1128, 1641, 2290, ...  A336288
[5] 1, 12, 58, 164, 355, 656, 1092, 1688, 2469, 3460, ...
[6] 1, 14, 75, 220, 485, 906, 1519, 2360, 3465, 4870, ...
.
Triangle T(n, k) starts:
[0]  1;
[1]  2,   1;
[2]  3,   4,   1;
[3]  4,  10,   6,   1;
[4]  5,  20,  19,   8,   1;
[5]  6,  35,  44,  30,  10,   1;
[6]  7,  56,  85,  76,  43,  12,   1;
[7]  8,  84, 146, 155, 116,  58,  14,  1;
[8]  9, 120, 231, 276, 245, 164,  75, 16,  1;
[9] 10, 165, 344, 448, 446, 355, 220, 94, 18, 1;
.
A(2, 3) = card('', 0, 00, 000, 0000) + card('', 1, 0, 11, 10, 00, 110, 100, 1100) + card('', 1, 11, 111, 1111) = 5 + 9 + 5 = 19.
		

Crossrefs

Columns: A000012, A005843, A028878.
Cf. A361682 (combinations with unique elements), A361043 (multiset permutations).

Programs

  • SageMath
    def A(n: int, k: int) -> int:
        if n == 0: return k + 1
        count = 0
        for a in range(0, n * k + 1, n):
            S = [i < a for i in range(n * k)]
            count += Combinations(S).cardinality()
        return count
    def ARow(n: int, size: int) -> list[int]:
        return [A(n, k) for k in range(size)]
    for n in range(7): print([n], ARow(n, 6))
Showing 1-3 of 3 results.