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.

A283799 Number of dispersed Dyck prefixes of length 2n and height n.

Original entry on oeis.org

1, 2, 5, 12, 36, 90, 286, 728, 2380, 6120, 20349, 52668, 177100, 460460, 1560780, 4071600, 13884156, 36312408, 124403620, 326023280, 1121099408, 2942885946, 10150595910, 26681566392, 92263734836, 242799302200, 841392966470, 2216352204360, 7694644696200
Offset: 0

Views

Author

Alois P. Heinz, Mar 16 2017

Keywords

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<3, 1+n^2, ((512*(2*n-5))
          *(2519*n-1279)*(n-2)*(2*n-3)*a(n-3) +(192*(2*n-3))
          *(1710*n^3-443*n^2-4990*n+2483)*a(n-2) -(24*(22671*n^4
          -124866*n^3+216436*n^2-129032*n+24526))*a(n-1))
           / ((3*n+2)*(27*n+9)*(855*n-1504)*n))
        end:
    seq(a(n), n=0..30);
    a := n -> binomial(2*n, n-iquo(n+1, 2)) + binomial(2*n, iquo(n+1,2)-1):
    seq(a(n), n = 0..28);  # Peter Luschny, Jan 17 2025
  • Mathematica
    b[x_, y_, m_] := b[x, y, m] = If[x == 0, z^m, If[y > 0, b[x - 1, y - 1, m], 0] + If[y == 0, b[x - 1, y, m], 0] + b[x - 1, y + 1, Max[m, y + 1]]];
    a[n_] := Coefficient[b[2n, 0, 0], z, n];
    a /@ Range[0, 30] (* Jean-François Alcover, Dec 21 2020, after Alois P. Heinz in A282869 *)

Formula

Recursion: see Maple program.
a(n) = A282869(2*n, n).
From Vaclav Kotesovec, Mar 26 2018: (Start)
Recurrence: 3*n*(3*n + 1)*(3*n + 2)*(3*n^3 - 11*n^2 + 10*n - 3)*a(n) = - 24*(2*n - 1)*(6*n^3 - 1)*a(n-1) + 64*(n-1)*(2*n - 3)*(2*n - 1)*(3*n^3 - 2*n^2 - 3*n - 1)*a(n-2).
a(n) ~ ((3+2*sqrt(3)) - (-1)^n*(3-2*sqrt(3))) * 2^(4*n + 1) / (sqrt(Pi*n) * 3^(3*n/2 + 2)). (End)
From Peter Luschny, Jan 17 2025: (Start)
a(n) = binomial(2*n, n - floor(n/2 + 1/2)) + binomial(2*n, floor(n/2 + 1/2) - 1).
a(n) = A379822(n, (n + 1)/2). (End)

A378067 Triangle read by rows: T(n, k) is the number of walks of length n with unit steps in all four directions (NSWE) starting at (0, 0), staying in the upper plane (y >= 0), and ending on the vertical line x = 0 if k = 0, or on the line x = k or x = -(n + 1 - k) if k > 0.

Original entry on oeis.org

1, 1, 2, 4, 3, 3, 9, 10, 6, 10, 36, 25, 20, 20, 25, 100, 101, 55, 50, 55, 101, 400, 301, 231, 126, 126, 231, 301, 1225, 1226, 742, 490, 294, 490, 742, 1226, 4900, 3921, 3144, 1632, 1008, 1008, 1632, 3144, 3921, 15876, 15877, 10593, 7137, 3348, 2592, 3348, 7137, 10593, 15877
Offset: 0

Views

Author

Peter Luschny, Dec 08 2024

Keywords

Examples

			Triangle starts:
  [0] [    1]
  [1] [    1,     2]
  [2] [    4,     3,     3]
  [3] [    9,    10,     6,   10]
  [4] [   36,    25,    20,   20,   25]
  [5] [  100,   101,    55,   50,   55,  101]
  [6] [  400,   301,   231,  126,  126,  231,  301]
  [7] [ 1225,  1226,   742,  490,  294,  490,  742, 1226]
  [8] [ 4900,  3921,  3144, 1632, 1008, 1008, 1632, 3144,  3921]
  [9] [15876, 15877, 10593, 7137, 3348, 2592, 3348, 7137, 10593, 15877]
.
For n = 3 we get the walks depending on the x-coordinate of the endpoint:
W(x= 3) = {WWW},
W(x= 2) = {NWW,WNW,WWN},
W(x= 1) = {NNW,NSW,NWN,NWS,WWE,WEW,EWW,WNN,WNS},
W(x= 0) = {NNN,NNS,NSN,NWE,NEW,WNE,WEN,ENW,EWN},
W(x=-1) = {NNE,NEN,ENN,NSE,NES,WEE,ENS,EWE,EEW},
W(x=-2) = {NEE,ENE,EEN},
W(x=-3) = {EEE}.
T(3, 0) = card(W(x=0)) = 9, T(3, 1) = card(W(x=1)) + card(W(x=-3)) = 10,
T(3, 2) = card(W(x=2)) + card(W(x=-2)) = 6, T(3, 3) = card(W(x=3)) + card(W(x=-1)) = 10.
		

Crossrefs

Related triangles: A052174 (first quadrant), this triangle (upper plane), A379822 (whole plane).
Cf. A018224 (column 0), A001700 (row sums), A378069 (row sum without column 0), A380121 (row minimum).

Programs

  • Python
    from dataclasses import dataclass
    @dataclass
    class Walk:
        s: str = ""
        x: int = 0
        y: int = 0
    def Trow(n: int) -> list[int]:
        W = [Walk()]
        row = [0] * (n + 1)
        for w in W:
            if len(w.s) == n:
                row[w.x] += 1
            else:
                for s in "NSWE":
                    x = y = 0
                    match s:
                        case "W": x =  1
                        case "E": x = -1
                        case "N": y =  1
                        case "S": y = -1
                        case _  : pass
                    if w.y + y >= 0:
                        W.append(Walk(w.s + s, w.x + x, w.y + y))
        return row
    for n in range(10): print(Trow(n))

Formula

Sum_{k=1..n} T(n, k) = 2 * A378069(n).

A380120 Triangle read by rows: T(n, k) is the number of walks of length n on the Z X Z grid with unit steps in all four directions (NSWE) starting at (0, 0). k is the absolute value of the x-coordinate of the endpoint of the walk.

Original entry on oeis.org

1, 2, 2, 6, 8, 2, 20, 30, 12, 2, 70, 112, 56, 16, 2, 252, 420, 240, 90, 20, 2, 924, 1584, 990, 440, 132, 24, 2, 3432, 6006, 4004, 2002, 728, 182, 28, 2, 12870, 22880, 16016, 8736, 3640, 1120, 240, 32, 2, 48620, 87516, 63648, 37128, 17136, 6120, 1632, 306, 36, 2
Offset: 0

Views

Author

Peter Luschny, Jan 17 2025

Keywords

Examples

			Triangle starts:
  [0] [    1]
  [1] [    2,     2]
  [2] [    6,     8,     2]
  [3] [   20,    30,    12,     2]
  [4] [   70,   112,    56,    16,     2]
  [5] [  252,   420,   240,    90,    20,    2]
  [6] [  924,  1584,   990,   440,   132,   24,    2]
  [7] [ 3432,  6006,  4004,  2002,   728,  182,   28,   2]
  [8] [12870, 22880, 16016,  8736,  3640, 1120,  240,  32,  2]
  [9] [48620, 87516, 63648, 37128, 17136, 6120, 1632, 306, 36, 2]
.
For n = 0 there is only the empty walk w = '' with start and end point (x=0, y=0).
For n = 3 the walks depending on the x-coordinate of the endpoint are:
W(x= 3) = {WWW},
W(x= 2) = {NWW,SWW,WNW,WSW,WWN,WWS},
W(x= 1) = {NNW,NSW,NWN,NWS,SNW,SSW,SWN,SWS,WNN,WNS,WSN,WSS,WWE,WEW,EWW},
W(x= 0) = {NNN,NNS,NSN,NSS,NWE,NEW,SNN,SNS,SSN,SSS,SWE,SEW,WNE,WSE,WEN,WES,ENW,ESW,EWN,EWS},
W(x=-1) = {NNE,NSE,NEN,NES,SNE,SSE,SEN,SES,WEE,ENN,ENS,ESN,ESS,EWE,EEW},
W(x=-2) = {NEE,SEE,ENE,ESE,EEN,EES},
W(x=-3) = {EEE}.
T(3, 0) = card(W(x=0)) = 20, T(3, 1) = card(W(x=1)) + card(W(x=-1)) = 30,
T(3, 2) = card(W(x=2)) + card(W(x=-2)) = 12, T(3, 3) = card(W(x=3)) + card(W(x=-3)) = 2.
		

Crossrefs

Related triangles: A052174 (N X N), A378067 (Z X N), A379822 (Z X Z, variant), A380119.
Cf. A000984 (column 0), A162551 (column 1), A006659 (column 2), A000302 (row sums), A068551 (row sum without column 0), A040000 (row minimum).

Programs

  • Maple
    T := (n, k) -> ifelse(k = 0, binomial(2*n, n - k), 2*binomial(2*n, n - k)):
    seq(print(seq(T(n, k), k = 0..n)), n = 0..9);
  • Python
    from dataclasses import dataclass
    @dataclass
    class Walk:
        s: str = ""
        x: int = 0
        y: int = 0
    def Trow(n: int) -> list[int]:
        W = [Walk()]
        row = [0] * (n + 1)
        for w in W:
            if len(w.s) == n:
                row[abs(w.x)] += 1
            else:
                for s in "NSWE":
                    x = y = 0
                    match s:
                        case "W": x =  1
                        case "E": x = -1
                        case "N": y =  1
                        case "S": y = -1
                        case _  : pass
                    W.append(Walk(w.s + s, w.x + x, w.y + y))
        return row
    for n in range(10): print(Trow(n))

Formula

T(n, k) = binomial(2*n, n - k) if k = 0, otherwise 2*binomial(2*n, n - k).
Assuming the columns starting at n = 0, i.e. prepended by k zeros:
T(n, k) = [x^n] (2^(2*k+1)*x^k / (sqrt(1-4*x)*(1+sqrt(1-4*x))^(2*k))) for k >= 1.
T(n, k) = n! * [x^n] (2*BesselI(k, 2*x)*exp(2*x)) for k >= 1.
Showing 1-3 of 3 results.