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-10 of 16 results. Next

A059020 Number of 2 X n checkerboards (with at least one red square) in which the set of red squares is edge connected.

Original entry on oeis.org

0, 3, 13, 40, 108, 275, 681, 1664, 4040, 9779, 23637, 57096, 137876, 332899, 803729, 1940416, 4684624, 11309731, 27304157, 65918120, 159140476, 384199155, 927538873, 2239276992, 5406092952, 13051462995, 31509019045, 76069501192, 183648021540, 443365544387
Offset: 0

Views

Author

John W. Layman, Dec 14 2000

Keywords

Comments

In other words, the number of connected (non-null) induced subgraphs in the n-ladder graph P_2 X P_n. - Eric W. Weisstein, May 02 2017
Also, the number of cycles in the grid graph P_3 X P_{n+1}. - Andrew Howroyd, Jun 12 2017

Crossrefs

Row 2 of A287151 and row 2 of A231829.
See also A059021, A059524.
Cf. A000129. - Jaume Oliver Lafont, Sep 28 2009
Other sequences counting connected induced subgraphs: A020873, A059525, A286139, A286182, A286183, A286184, A286185, A286186, A286187, A286188, A286189, A286191, A285765, A285934, A286304.

Programs

  • Magma
    I:=[0, 3, 13, 40];[n le 4 select I[n] else 4*Self(n-1) - 4*Self(n-2) + Self(n-4):n in [1..30]]; // Marius A. Burtea, Aug 25 2019
  • Mathematica
    Join[{0},LinearRecurrence[{4, -4, 0, 1}, {3, 13, 40, 108}, 20]] (* Eric W. Weisstein, May 02 2017 *) (* adapted by Vincenzo Librandi, May 09 2017 *)
    Table[(LucasL[n + 3, 2] - 8 n - 14)/4, {n, 0, 20}] (* Eric W. Weisstein, May 02 2017 *)

Formula

a(n) = 2*a(n-1) + a(n-2) + 4*n - 1.
From Jaume Oliver Lafont, Nov 23 2008: (Start)
a(n) = 3*a(n-1) - a(n-2) - a(n-3) + 4;
a(n) = 4*a(n-1) - 4*a(n-2) + a(n-4). (End)
G.f.: x*(3+x)/((1-2*x-x^2)*(1-x)^2). - Jaume Oliver Lafont, Sep 28 2009
Empirical observations (from Superseeker):
(1) if b(n) = a(n) + n then {b(n)} is A048777;
(2) if b(n) = a(n+3) - 3*a(n+2) - 3*a(n+1) + a(n) then {b(n)} is A052542;
(3) if b(n) = a(n+2) - 2*a(n+1) + a(n) then {b(n)} is A001333.
4*a(n) = A002203(n+3) - 8*n - 14. - Eric W. Weisstein, May 02 2017
a(n) = 3*A048776(n-1) + A048776(n-2). - R. J. Mathar, May 12 2019
E.g.f.: (1/2)*exp(x)*(-7-4*x+7*cosh(sqrt(2)*x)+5*sqrt(2)*sinh(sqrt(2)*x)). - Stefano Spezia, Aug 25 2019

A140517 Number of cycles in an n X n grid.

Original entry on oeis.org

0, 1, 13, 213, 9349, 1222363, 487150371, 603841648931, 2318527339461265, 27359264067916806101, 988808811046283595068099, 109331355810135629946698361371, 36954917962039884953387868334644457, 38157703688577845304445530851242055267353, 120285789340533859558405124213592877516931371715
Offset: 0

Views

Author

Don Knuth, Jul 26 2008

Keywords

Comments

Or, number of simply connected and rookwise connected regions of an (n-1) X (n-1) grid.

References

  • D. E. Knuth, The Art of Computer Programming, Volume 4A, Section 7.1.4.

Crossrefs

Corner-to-corner paths in this grid are enumerated in A007764.
Main diagonal of A231829.

Programs

  • Mathematica
    Table[Length[FindCycle[GridGraph[{n, n}], Infinity, All]], {n, 6}] (* Eric W. Weisstein, Mar 07 2023 *)
  • Python
    # Using graphillion
    from graphillion import GraphSet
    import graphillion.tutorial as tl
    def A140517(n):
        if n == 0: return 0
        universe = tl.grid(n, n)
        GraphSet.set_universe(universe)
        cycles = GraphSet.cycles()
        return cycles.len()
    print([A140517(n) for n in range(9)])  # Seiichi Manyama, Mar 23 2020

Extensions

a(9) calculated using the ZDD technique described in Knuth's The Art of Computer Programming, Exercises 7.1.4, by Ashutosh Mehra, Dec 19 2008
a(10)-a(19) calculated using a transfer matrix method by Artem M. Karavaev, Jun 03 2009, Oct 20 2009
a(20)-a(26) calculated by Hiroaki Iwashita, Apr 26 2013, Nov 18 2013
Edited by Max Alekseyev, Jan 24 2018

A321172 Triangle read by rows: T(m,n) = number of Hamiltonian cycles on m X n grid of points (m >= 2, 2 <= n <= m).

Original entry on oeis.org

1, 1, 0, 1, 2, 6, 1, 0, 14, 0, 1, 4, 37, 154, 1072, 1, 0, 92, 0, 5320, 0, 1, 8, 236, 1696, 32675, 301384, 4638576, 1, 0, 596, 0, 175294, 0, 49483138, 0, 1, 16, 1517, 18684, 1024028, 17066492, 681728204, 13916993782, 467260456608
Offset: 2

Views

Author

Robert FERREOL, Jan 10 2019

Keywords

Comments

Orientation of the path is not important; you can start going either clockwise or counterclockwise. Paths related by symmetries are considered distinct.
The m X n grid of points when drawn forms a (m-1) X (n-1) rectangle of cells, so m-1 and n-1 are sometimes used as indices instead of m and n (see, e. g., Kreweras' reference below).
These cycles are also called "closed non-intersecting rook's tours" on m X n chess board.

Examples

			T(5,4)=14 is illustrated in the links above.
Table starts:
=================================================================
m\n|  2    3      4       5         6           7            8
---|-------------------------------------------------------------
2  |  1    1      1       1         1           1            1
3  |  1    0      2       0         4           0            8
4  |  1    2      6      14        37          92          236
5  |  1    0     14       0       154           0         1696
6  |  1    4     37     154      1072        5320        32675
7  |  1    0     92       0      5320           0       301384
8  |  1    8    236    1696     32675      301384      4638576
The table is symmetric, so it is completely described by its lower-left half.
		

Crossrefs

Row/column k=4..12 are: (with interspersed zeros for odd k): A006864, A006865, A145401, A145416, A145418, A160149, A180504, A180505, A213813.
Cf. A003763 (bisection of main diagonal), A222200 (subdiagonal), A231829, A270273, A332307.
T(n,2n) gives A333864.

Programs

  • Python
    # Program due to Laurent Jouhet-Reverdy
    def cycle(m, n):
         if (m%2==1 and n%2==1): return 0
         grid = [[0]*n for _ in range(m)]
         grid[0][0] = 1; grid[1][0] = 1
         counter = [0]; stop = m*n-1
         def run(i, j, nb_points):
             for ni, nj in [(i-1, j), (i+1, j), (i, j+1), (i, j-1)] :
                 if  0<=ni<=m-1 and 0<=nj<=n-1 and grid[ni][nj]==0 and (ni,nj)!=(0,1):
                     grid[ni][nj] = 1
                     run(ni, nj, nb_points+1)
                     grid[ni][nj] = 0
                 elif (ni,nj)==(0,1) and nb_points==stop:
                     counter[0] += 1
         run(1, 0, 2)
         return counter[0]
    L=[];n=7#maximum for a time < 1 mn
    for i in range(2,n):
        for j in range(2,i+1):
           L.append(cycle(i,j))
    print(L)

Formula

T(m,n) = T(n,m).
T(2m+1,2n+1) = 0.
T(2n,2n) = A003763(n).
T(n,n+1) = T(n+1,n) = A222200(n).
G. functions , G_m(x)=Sum {n>=0} T(m,n-2)*x^n after Stoyan's link p. 18 :
G_2(x) = 1/(1-x) = 1+x+x^2+...
G_3(x) = 1/(1-2*x^2) = 1+2*x^2+4*x^4+...
G_4(x) = 1/(1-2*x-2*x^2+2*x^3-x^4) = 1+2*x+6*x^2+...
G_5(x) = (1+3*x^2)/(1-11*x^2-2*x^6) = 1+14*x^2+154*x^4+...

Extensions

More terms from Pontus von Brömssen, Feb 15 2021

A332307 Array read by antidiagonals: T(m,n) is the number of (undirected) Hamiltonian paths in the m X n grid graph.

Original entry on oeis.org

1, 1, 1, 1, 4, 1, 1, 8, 8, 1, 1, 14, 20, 14, 1, 1, 22, 62, 62, 22, 1, 1, 32, 132, 276, 132, 32, 1, 1, 44, 336, 1006, 1006, 336, 44, 1, 1, 58, 688, 3610, 4324, 3610, 688, 58, 1, 1, 74, 1578, 12010, 26996, 26996, 12010, 1578, 74, 1, 1, 92, 3190, 38984, 109722, 229348, 109722, 38984, 3190, 92, 1
Offset: 1

Views

Author

Andrew Howroyd, Feb 09 2020

Keywords

Examples

			Array begins:
================================================
m\n | 1  2   3     4      5       6        7
----+-------------------------------------------
  1 | 1  1   1     1      1       1        1 ...
  2 | 1  4   8    14     22      32       44 ...
  3 | 1  8  20    62    132     336      688 ...
  4 | 1 14  62   276   1006    3610    12010 ...
  5 | 1 22 132  1006   4324   26996   109722 ...
  6 | 1 32 336  3610  26996  229348  1620034 ...
  7 | 1 44 688 12010 109722 1620034 13535280 ...
  ...
		

Crossrefs

Formula

T(n,m) = T(m,n).

A288518 Array read by antidiagonals: T(m,n) = number of (undirected) paths in the grid graph P_m X P_n.

Original entry on oeis.org

0, 1, 1, 3, 12, 3, 6, 49, 49, 6, 10, 146, 322, 146, 10, 15, 373, 1618, 1618, 373, 15, 21, 872, 7119, 14248, 7119, 872, 21, 28, 1929, 28917, 111030, 111030, 28917, 1929, 28, 36, 4118, 111360, 801756, 1530196, 801756, 111360, 4118, 36
Offset: 1

Views

Author

Andrew Howroyd, Jun 10 2017

Keywords

Comments

Paths of length zero are not counted here.

Examples

			Table starts:
=================================================================
m\n|  1    2      3       4         5          6            7
---|-------------------------------------------------------------
1  |  0    1      3       6        10         15           21 ...
2  |  1   12     49     146       373        872         1929 ...
3  |  3   49    322    1618      7119      28917       111360 ...
4  |  6  146   1618   14248    111030     801756      5493524 ...
5  | 10  373   7119  111030   1530196   19506257    235936139 ...
6  | 15  872  28917  801756  19506257  436619868   9260866349 ...
7  | 21 1929 111360 5493524 235936139 9260866349 343715004510 ...
...
		

Crossrefs

A360196 Array read by antidiagonals: T(m,n) is the number of induced cycles in the grid graph P_m X P_n.

Original entry on oeis.org

1, 2, 2, 3, 5, 3, 4, 9, 9, 4, 5, 14, 24, 14, 5, 6, 20, 58, 58, 20, 6, 7, 27, 125, 229, 125, 27, 7, 8, 35, 251, 749, 749, 251, 35, 8, 9, 44, 490, 2180, 3436, 2180, 490, 44, 9, 10, 54, 948, 6188, 13350, 13350, 6188, 948, 54, 10, 11, 65, 1823, 17912, 50203, 65772, 50203, 17912, 1823, 65, 11
Offset: 2

Views

Author

Andrew Howroyd, Jan 29 2023

Keywords

Comments

Induced cycles are sometimes called chordless cycles (but some definitions require chordless cycles to have a cycle length of at least 4).

Examples

			Array begins:
========================================================
m\n| 2  3   4     5      6       7        8        9 ...
---+----------------------------------------------------
2  | 1  2   3     4      5       6        7        8 ...
3  | 2  5   9    14     20      27       35       44 ...
4  | 3  9  24    58    125     251      490      948 ...
5  | 4 14  58   229    749    2180     6188    17912 ...
6  | 5 20 125   749   3436   13350    50203   196918 ...
7  | 6 27 251  2180  13350   65772   308212  1535427 ...
8  | 7 35 490  6188  50203  308212  1743247 10614143 ...
9  | 8 44 948 17912 196918 1535427 10614143 78586742 ...
   ...
		

Crossrefs

Main diagonal is A297664.
Rows 2..5 are A000027(n-1), A000096(n-1), A360197, A360198.
Cf. A231829 (undirected cycles), A287151 (connected induced subgraphs), A360199 (induced paths), A360202 (induced trees), A360913 (maximum induced cycles).

Formula

T(m,n) = T(n,m).

A339098 Square array T(n,k), n >= 2, k >= 2, read by antidiagonals, where T(n,k) is the number of (undirected) cycles on the n X k king graph.

Original entry on oeis.org

7, 30, 30, 85, 348, 85, 204, 3459, 3459, 204, 451, 33145, 136597, 33145, 451, 954, 316164, 4847163, 4847163, 316164, 954, 1969, 3013590, 171903334, 545217435, 171903334, 3013590, 1969, 4008, 28722567, 6109759868, 61575093671, 61575093671, 6109759868, 28722567, 4008
Offset: 2

Views

Author

Seiichi Manyama, Nov 27 2020

Keywords

Examples

			Square array T(n,k) begins:
    7,     30,        85,         204,            451, ...
   30,    348,      3459,       33145,         316164, ...
   85,   3459,    136597,     4847163,      171903334, ...
  204,  33145,   4847163,   545217435,    61575093671, ...
  451, 316164, 171903334, 61575093671, 21964731190911, ...
		

Crossrefs

Rows and columns 2..5 give A339196, A339197, A339198, A339199.
Main diagonal gives A234622.

Programs

  • Python
    # Using graphillion
    from graphillion import GraphSet
    def make_nXk_king_graph(n, k):
        grids = []
        for i in range(1, k + 1):
            for j in range(1, n):
                grids.append((i + (j - 1) * k, i + j * k))
                if i < k:
                    grids.append((i + (j - 1) * k, i + j * k + 1))
                if i > 1:
                    grids.append((i + (j - 1) * k, i + j * k - 1))
        for i in range(1, k * n, k):
            for j in range(1, k):
                grids.append((i + j - 1, i + j))
        return grids
    def A339098(n, k):
        universe = make_nXk_king_graph(n, k)
        GraphSet.set_universe(universe)
        cycles = GraphSet.cycles()
        return cycles.len()
    print([A339098(j + 2, i - j + 2) for i in range(9 - 1) for j in range(i + 1)])

Formula

T(n,k) = T(k,n).

A232103 Square array read by antidiagonals: T(m,n) = number of ways of drawing a simple loop on an m x n rectangular lattice of dots in such a way that it touches each edge.

Original entry on oeis.org

1, 1, 1, 1, 5, 1, 1, 15, 15, 1, 1, 39, 106, 39, 1, 1, 97, 582, 582, 97, 1, 1, 237, 2952, 6074, 2952, 237, 1, 1, 575, 14488, 56778, 56778, 14488, 575, 1, 1, 1391, 69982, 510600, 943340, 510600, 69982, 1391, 1, 1, 3361, 335356, 4502836, 15009212, 15009212
Offset: 1

Views

Author

Douglas Boffey, Nov 21 2013

Keywords

Comments

This sequence is to be read as a table:
1, 1, 1, 1, 1, ...
1, 5, 15, 39, ...
1, 15, 106, ...
1, 39, ...
1, ...
...
This represents the number of simple, closed loops that can be formed on an m x n lattice of dots in such a way that it touches each edge.
This sequence is related to A231829, called b(i,j) by a(i,j) = b(i,j) - 2 * b(i,j-1) + b(i,j-2) - 2 * b(i-1,j) + 4 * b(i-1,j-1) - 2 * b(j-1,j-2) + b(i-2,j) - 2 * b(i-2,j-1) + b(i-2,j-2).
Equivalently, the number of fixed polyominoes without holes that have a width of m and height of n. - Andrew Howroyd, Oct 04 2017

Examples

			Array begins:
==============================================================
m\n| 1   2     3       4         5           6            7
---|----------------------------------------------------------
1  | 1   1     1       1         1           1            1...
2  | 1   5    15      39        97         237          575...
3  | 1  15   106     582      2952       14488        69982...
4  | 1  39   582    6074     56778      510600      4502836...
5  | 1  97  2952   56778    943340    15009212    234411981...
6  | 1 237 14488  510600  15009212   419355340  11509163051...
7  | 1 575 69982 4502836 234411981 11509163051 554485727288...
... - _Andrew Howroyd_, Oct 04 2017
a(3,2) is 15, thus:
1)        2)        3)        4)        5)
+-+-+-+   +-+-+-+   + +-+-+   +-+-+-+   +-+-+-+
|     |   |     |     |   |   |     |   |     |
+ +-+-+   +-+ +-+   +-+ +-+   + + +-+   +-+-+ +
| |         | |     |   |     |   |         | |
+-+ + +   + +-+ +   +-+-+ +   +-+-+ +   + + +-+
6)        7)        8)        9)        10)
+-+-+-+   +-+-+ +   +-+-+-+   +-+ + +   + +-+ +
|     |   |   |     |     |   | |         | |
+ +-+ +   +-+ +-+   +-+ + +   + +-+-+   +-+ +-+
| | | |     |   |     |   |   |     |   |     |
+-+ +-+   + +-+-+   + +-+-+   +-+-+-+   +-+-+-+
11)       12)       13)       14)       15)
+-+-+ +   + + +-+   +-+ +-+   + +-+-+   +-+-+-+
|   |         | |   | | | |     |   |   |     |
+   +-+   +-+-+ +   + +-+ +   +-+ + +   + + + +
|     |   |     |   |     |   |     |   |     |
+-+-+-+   +-+-+-+   +-+-+-+   +-+-+-+   +-+-+-+
		

Crossrefs

Rows 2-3 are A034182, A293263.
Main diagonal is A293261.

Formula

T(m, n) = U(m, n) - 2*U(m, n-1) + U(m, n-2) where U(m, n) = V(m, n) - 2*V(m-1, n) + V(m-2, n) and V(m, n) = A231829(m, n). - Andrew Howroyd, Oct 04 2017

A288637 Number of cycles in the grid graph P_4 X P_{n+1}.

Original entry on oeis.org

6, 40, 213, 1049, 5034, 23984, 114069, 542295, 2577870, 12253948, 58249011, 276885683, 1316170990, 6256394122, 29739651711, 141366874247, 671984773580, 3194266961582, 15183887824311, 72176324719925, 343088799809408, 1630866146364842, 7752291502484181
Offset: 1

Views

Author

Andrew Howroyd, Jun 12 2017

Keywords

Crossrefs

Row 3 of A231829.

Formula

Empirical: a(n) = 9*a(n-1)-27*a(n-2)+38*a(n-3)-29*a(n-4)+11*a(n-5)+a(n-6)-2*a(n-7) for n>7.
Empirical g.f.: x*(6 - 14*x + 15*x^2 - 16*x^3 - 2*x^4 + x^5) / ((1 - x)^2*(1 - 7*x + 12*x^2 - 7*x^3 + 3*x^4 + 2*x^5)). - Colin Barker, Jun 12 2017

A339117 Number of cycles in the grid graph P_5 X P_n.

Original entry on oeis.org

10, 108, 1049, 9349, 80626, 692194, 5948291, 51139577, 439673502, 3779989098, 32497334055, 279386435639, 2401945965628, 20650054358200, 177533025653767, 1526290165248783, 13121849649571820, 112811405309454694, 969864273118112913, 8338134834111643373, 71684765011673779732
Offset: 2

Views

Author

Seiichi Manyama, Nov 24 2020

Keywords

Comments

a(n+1) / a(n) tends to 8.597218255461742020947886618374491114891840151635008721734194641555448999... - Vaclav Kotesovec, Nov 24 2020

Crossrefs

Programs

  • Python
    # Using graphillion
    from graphillion import GraphSet
    import graphillion.tutorial as tl
    def A(n, k):
        universe = tl.grid(n - 1, k - 1)
        GraphSet.set_universe(universe)
        cycles = GraphSet.cycles()
        return cycles.len()
    def A339117(n):
        return A(n, 5)
    print([A339117(n) for n in range(2, 15)])

Formula

Empirical g.f.: -x^2*(10 - 42*x + 149*x^2 - 300*x^3 - 393*x^4 + 693*x^5 + 230*x^6 - 473*x^7 - 72*x^8 + 202*x^9 + 84*x^10) / ((1 - x)^2 * (-1 + 13*x - 45*x^2 + 66*x^3 - 17*x^4 - 209*x^5 + 151*x^6 + 140*x^7 - 112*x^8 - 48*x^9 + 50*x^10 + 28*x^11)). - Vaclav Kotesovec, Nov 24 2020
Showing 1-10 of 16 results. Next