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: Witold Tatkiewicz

Witold Tatkiewicz's wiki page.

Witold Tatkiewicz has authored 10 sequences.

A326409 Minesweeper sequence of positive integers arranged on a 2D grid along Hamiltonian path.

Original entry on oeis.org

2, -1, -1, 3, -1, 3, -1, 3, 4, 2, -1, 3, -1, 3, 3, 2, -1, 4, -1, 2, 2, 1, -1, 2, 3, 1, 1, 2, -1, 3, -1, 3, 3, 2, 3, 2, -1, 1, 2, 2, -1, 2, -1, 2, 2, 2, -1, 1, 1, 0, 1, 2, -1, 2, 3, 1, 2, 2, -1, 2, -1, 1, 1, 1, 1, 2, -1, 1, 2, 1, -1, 3, -1, 2, 2, 1, 2, 3, -1, 1
Offset: 1

Author

Witold Tatkiewicz, Oct 07 2019

Keywords

Comments

Place positive integers on a 2D grid starting with 1 in the top left corner and continue along Hamiltonian path A163361 or A163363.
Replace each prime with -1 and each nonprime by the number of primes in adjacent grid cells around it.
n is replaced by a(n).
This sequence treats prime numbers as "mines" and fills gaps according to rules of the classic Minesweeper game.
a(n) < 5.
Set of n such that a(n) = 4 is unbounded (conjectured).

Examples

			Consider positive integers distributed onto the plane along an increasing Hamiltonian path (in this case it starts downwards):
.
   1   4---5---6  59--60--61  64--...
   |   |       |   |       |   |
   2---3   8---7  58--57  62--63
           |           |
  15--14   9--10  55--56  51--50
   |   |       |   |       |   |
  16  13--12--11  54--53--52  49
   |                           |
  17--18  31--32--33--34  47--48
       |   |           |   |
  20--19  30--29  36--35  46--45
   |           |   |           |
  21  24--25  28  37  40--41  44
   |   |   |   |   |   |   |   |
  22--23  26--27  38--39  42--43
.
1 is not prime and in adjacent grid cells there are 2 primes: 2 and 3. Therefore a(1) = 2.
2 is prime, therefore a(2) = -1.
8 is not prime and in adjacent grid cells there are 3 primes: 5, 3 and 7. Therefore a(8) = 3.
Replacing n with a(n) in the plane described above, and using "." for a(n) = 0 and "*" for negative a(n), we produce a graph resembling Minesweeper, where the mines are situated at prime n:
  2   3---*---3   *---2---*   1 ...
  |   |       |   |       |   |
  *---*   3---*   2---2   1---1
          |           |
  3---3   4---2   3---1   1---.
  |   |       |   |       |   |
  2   *---3---*   2---*---2   1
  |                           |
  *---4   *---3---3---2   *---1
      |   |           |   |
  2---*   3---*   2---3   2---2
  |           |   |           |
  2   2---3   2   *   2---*   2
  |   |   |   |   |   |   |   |
  1---*   1---1   1---2   2---*
In order to produce the sequence, the graph is read along its original mapping.
		

Crossrefs

Cf. A163361 (plane mapping), A163363 (alternative plane mapping).
Different arrangements of integers: A326405 (antidiagonals), A326406 (triangle maze), A326407 (square mapping), A326408 (square maze), A326410 (Ulam's spiral).

Programs

  • Mathematica
    Block[{nn = 4, s, t, u}, s = ConstantArray[0, {2^#, 2^#}] &[nn + 1]; t = First[HilbertCurve@ # /. Line -> List] &[nn + 1] &[nn + 1]; s = ArrayPad[ReplacePart[s, Array[{1, 1} + t[[#]] -> # &, 2^(2 (nn + 1))]], {{1, 0}, {1, 0}}]; u = Table[If[PrimeQ@ m, -1, Count[#, _?PrimeQ] &@ Union@ Map[s[[#1, #2]] & @@ # &, Join @@ Array[FirstPosition[s, m] + {##} - 2 &, {3, 3}]]], {m, (2^nn)^2}]]

A326410 Minesweeper sequence of positive integers arranged on a square spiral on a 2D grid.

Original entry on oeis.org

4, -1, -1, 3, -1, 3, -1, 3, 3, 2, -1, 5, -1, 2, 2, 2, -1, 3, -1, 3, 3, 2, -1, 2, 1, 0, 2, 3, -1, 3, -1, 3, 3, 1, 2, 2, -1, 3, 3, 2, -1, 3, -1, 1, 1, 2, -1, 2, 1, 1, 1, 1, -1, 2, 3, 2, 2, 2, -1, 2, -1, 2, 2, 1, 3, 3, -1, 1, 2, 3, -1, 4, -1, 3, 2, 0, 1, 2, -1, 1, 1
Offset: 1

Author

Witold Tatkiewicz, Oct 07 2019

Keywords

Comments

Place positive integers on a 2D grid starting with 1 in the center and continue along a spiral.
Replace each prime with -1 and each nonprime with the number of primes in adjacent grid cells around it.
n is replaced by a(n).
This sequence treats prime numbers as "mines" and fills gaps according to the rules of the classic Minesweeper game.
a(n) = 5 for n = 12.
Set of n such that a(n) = 4 is unbounded (conjecture).

Examples

			Consider positive integers distributed onto the plane along the square spiral:
.
  37--36--35--34--33--32--31
   |                       |
  38  17--16--15--14--13  30
   |   |               |   |
  39  18   5---4---3  12  29
   |   |   |       |   |   |
  40  19   6   1---2  11  28
   |   |   |           |   |
  41  20   7---8---9--10  27
   |   |                   |
  42  21--22--23--24--25--26
   |
  43--44--45--46--47--48--49--...
.
1 is not prime and in adjacent grid cells there are 4 primes: 2, 3, 5 and 7. Therefore a(1) = 4.
2 is prime, therefore a(2) = -1.
8 is not prime and in adjacent grid cells there are 4 primes: 2, 7 and 23. Therefore a(8) = 3.
Replacing n with a(n) in the plane described above, and using "." for a(n) = 0 and "*" for negative a(n), we produce a graph resembling Minesweeper, where the mines are situated at prime n:
  *---2---2---1---3---3---*
  |                       |
  3   *---2---2---2---*   3
  |   |               |   |
  3   3   *---3---*   5   *
  |   |   |       |   |   |
  2   *   3   4---*   *   3
  |   |   |           |   |
  *   3   *---3---3---2   2
  |   |                   |
  3   3---2---*---2---1---.
  |
  *---1---1---2---*---2---1---...
In order to produce the sequence, the graph is read along the square spiral.
		

Crossrefs

Cf. A136626 - similar sequence: For every number n in Ulam's spiral the sequence gives the number of primes around it (number n excluded).
Cf. A136627 - similar sequence: For every number n in Ulam's spiral the sequence gives the number of primes around it (number n included).
Different arrangements of integers:
Cf. A326405 (antidiagonals), A326406 (triangle maze), A326407 (square mapping), A326408 (square maze), A326409 (Hamiltonian path).

A326408 Minesweeper sequence of positive integers arranged on a 2D grid along a square maze.

Original entry on oeis.org

2, -1, -1, 3, -1, 3, -1, 4, 3, 1, -1, 4, -1, 3, 4, 2, -1, 2, -1, 2, 3, 3, -1, 2, 1, 0, 2, 3, -1, 2, -1, 2, 2, 1, 3, 2, -1, 1, 1, 2, -1, 4, -1, 2, 3, 3, -1, 1, 0, 0, 2, 3, -1, 1, 1, 1, 3, 3, -1, 3, -1, 2, 2, 1, 0, 1, -1, 3, 3, 2, -1, 2, -1, 2, 1, 0, 1, 2, -1, 2, 1
Offset: 1

Author

Witold Tatkiewicz, Oct 04 2019

Keywords

Comments

Place positive integers on 2D grid starting with 1 in the top left corner and continue along the square maze as in A081344.
Replace each prime with -1 and each nonprime with the number of primes in adjacent grid cells around it.
n is replaced by a(n).
This sequence treats prime numbers as "mines" and fills gaps according to the rules of the classic Minesweeper game.
a(n) < 5.
Set of n such that a(n) = 4 is unbounded (conjectured).

Examples

			Consider positive integers distributed onto the plane along increasing square array:
   1  4  5 16 17 36 ...
   2  3  6 15 18 35
   9  8  7 14 19 34
  10 11 12 13 20 33
  25 24 23 22 21 32
  26 27 28 29 30 31
...
1 is not prime and in adjacent grid cells there are 2 primes: 2 and 3. Therefore a(1) = 2.
2 is prime, therefore a(2) = -1.
8 is not prime and in adjacent grid cells there are 4 primes: 2, 3, 7 and 11. Therefore a(8) = 4.
Replacing n with a(n) in the plane described above, and using "." for a(n) = 0 and "*" for negative a(n), we produce a graph resembling Minesweeper, where the mines are situated at prime n:
  2  3  *  2  *  2  *  1  .  1  *  1 ...
  *  *  3  4  2  3  1  2  1  3  2  2
  3  4  *  3  *  1  1  2  *  3  *  1
  1  *  4  *  2  2  2  *  3  *  2  2
  1  2  *  3  3  2  *  3  3  1  2  2
  .  2  3  *  2  *  4  *  2  2  2  *
  .  1  *  3  3  2  *  3  *  2  *  4
  .  2  3  *  1  1  1  3  2  4  3  *
  1  2  *  2  1  .  1  2  *  2  *  2
  1  *  2  1  .  .  1  *  3  3  1  1
  1  1  1  .  1  1  2  2  *  2  1  .
  .  1  1  1  1  *  2  2  2  *  1  1
...
In order to produce the sequence, the graph is read along its original mapping.
		

Crossrefs

Cf. A081344 - plane mapping
Different arrangements of integers:
Cf. A326405 - antidiagonals,
Cf. A326406 - triangle maze,
Cf. A326407 - square mapping,
Cf. A326409 - Hamiltonian path,
Cf. A326410 - Ulam's spiral.

Programs

A326407 Minesweeper sequence of positive integers arranged on a 2D grid along a square array that grows by alternately adding a row at its bottom edge and a column at its right edge.

Original entry on oeis.org

2, -1, -1, 2, -1, 5, -1, 2, 1, 3, -1, 4, -1, 3, 2, 0, -1, 3, -1, 3, 3, 2, -1, 1, 0, 2, 3, 2, -1, 3, -1, 1, 2, 2, 2, 0, -1, 1, 2, 3, -1, 3, -1, 3, 3, 2, -1, 1, 0, 1, 2, 2, -1, 2, 3, 2, 3, 2, -1, 2, -1, 3, 2, 0, 1, 2, -1, 2, 1, 1, -1, 3, -1, 1, 1, 1, 3, 3, -1, 1, 0
Offset: 1

Author

Witold Tatkiewicz, Oct 02 2019

Keywords

Comments

Place positive integers on a 2D grid starting with 1 in the top left corner and continue along an increasing square array as in A060734.
Replace each prime with -1 and each nonprime with the number of primes in adjacent grid cells around them.
n is replaced by a(n).
This sequence treats prime numbers as "mines" and fills gaps according to the rules of the classic Minesweeper game.
a(n) < 6 (conjectured).
a(n) = 5 for n={6} (conjectured).
Set of n such that a(n) = 4 is unbounded (conjectured).

Examples

			Consider positive integers distributed onto the plane along an increasing square array:
   1  4  9 16 25 36
   2  3  8 15 24 35
   5  6  7 14 23 34
  10 11 12 13 22 33
  17 18 19 20 21 32
  26 27 28 29 30 31
...
1 is not prime and in adjacent grid cells there are 2 primes: 2 and 3. Therefore a(1) = 2.
2 is prime, therefore a(2) = -1.
8 is not prime and in adjacent grid cells there are 2 primes: 3, and 7. Therefore a(8) = 2.
Replacing n with a(n) in the plane described above, and using "." for a(n) = 0 and "*" for negative a(n), we produce a graph resembling Minesweeper, where the mines are situated at prime n:
  2  2  1  .  .  .  .  .  .  .  .  . ...
  *  *  2  2  1  2  1  2  1  1  .  1
  *  5  *  3  *  2  *  3  *  2  1  1
  3  *  4  *  2  2  2  *  3  *  1  1
  *  3  *  3  3  1  3  2  3  1  2  1
  2  3  2  *  3  *  3  *  1  .  1  *
  *  1  2  3  *  3  *  2  1  .  2  3
  1  2  2  *  2  3  2  3  1  2  2  *
  1  2  *  2  1  1  *  3  *  2  *  2
  2  *  3  2  .  2  3  *  3  3  1  1
  *  3  *  1  1  2  *  3  *  2  1  .
  1  2  1  2  2  *  3  3  2  *  1  1
...
In order to produce the sequence, the graph is read along the original mapping.
		

Crossrefs

Cf. A060734 - plane mapping
Different arrangements of integers:
Cf. A326405 - antidiagonals,
Cf. A326406 - triangle maze,
Cf. A326408 - square maze,
Cf. A326409 - Hamiltonian path,
Cf. A326410 - Ulam's spiral.

Programs

A326406 Minesweeper sequence of positive integers arranged on a 2D grid along a triangular maze.

Original entry on oeis.org

3, -1, -1, 2, -1, 3, -1, 4, 4, 1, -1, 3, -1, 3, 2, 1, -1, 3, -1, 3, 2, 1, -1, 2, 3, 2, 3, 1, -1, 3, -1, 2, 2, 1, 2, 1, -1, 2, 3, 1, -1, 3, -1, 3, 2, 1, -1, 2, 3, 2, 3, 2, -1, 2, 1, 0, 1, 2, -1, 3, -1, 2, 2, 1, 2, 1, -1, 2, 2, 1, -1, 3, -1, 3, 4, 0, 1, 1
Offset: 1

Author

Witold Tatkiewicz, Oct 02 2019

Keywords

Comments

Write positive integers on a 2D grid starting with 1 in the top left corner and continue along the triangular maze as in A056023.
Replace each prime with -1 and each nonprime with the number of primes in adjacent grid cells around it.
n is replaced by a(n).
This sequence treats prime numbers as "mines" and fills gaps according to the rules of the classic Minesweeper game.
a(n) < 5 (conjectured).
Set of n such that a(n) = 4 is unbounded (conjectured).

Examples

			Consider positive integers placed on the plane along a triangular maze:
   1  2  6  7 15 16 ...
   3  5  8 14 17 ...
   4  9 13 18 ...
  10 12 19 ...
  11 20 ...
  21 ...
  ...
1 is not prime and in adjacent grid cells there are 3 primes: 2, 3 and 5. Therefore a(1) = 3.
2 is prime, therefore a(2) = -1.
8 is not prime and in adjacent grid cells there are 4 primes: 2, 5, 7 and 13. Therefore a(8) = 4.
Replacing n by a(n) in the plane described above, and using "." for a(n) = 0 and "*" for negative a(n), we produce a graph resembling Minesweeper, where the mines are situated at prime n:
  3  *  3  *  2  1  1  *  2  1  1  * ...
  *  *  4  3  *  3  3  3  *  2  2  2
  2  4  *  3  2  *  *  2  1  2  *  1
  1  3  *  3  2  3  3  2  1  1  1  2
  *  3  2  2  *  2  2  *  2  1  .  1
  2  *  1  1  3  *  3  2  *  2  1  1
  1  2  3  2  3  *  3  2  3  *  1  .
  1  2  *  *  3  2  2  *  2  1  2  2
  *  2  2  4  *  2  1  2  3  2  2  *
  1  1  .  2  *  3  1  1  *  *  2  3
  .  1  2  3  3  *  2  2  3  2  1  1
  1  2  *  *  2  1  2  *  1  .  .  1
...
In order to produce sequence graph is read along original mapping.
		

Crossrefs

Cf. A056023 - plane mapping
Different arrangements of integers:
Cf. A326405 - antidiagonals,
Cf. A326407 - square mapping,
Cf. A326408 - square maze,
Cf. A326409 - Hamiltonian path,
Cf. A326410 - Ulam's spiral.

Programs

A326405 Minesweeper sequence of positive integers arranged on a 2D grid along ascending antidiagonals.

Original entry on oeis.org

3, -1, -1, 3, -1, 2, -1, 4, 4, 0, -1, 4, -1, 2, 0, 3, -1, 3, -1, 1, 0, 2, -1, 3, 3, 1, 1, 0, -1, 3, -1, 2, 2, 1, 2, 0, -1, 3, 3, 2, -1, 2, -1, 2, 0, 2, -1, 2, 3, 2, 3, 2, -1, 1, 0, 1, 2, 2, -1, 3, -1, 2, 2, 1, 1, 0, -1, 1, 1, 3, -1, 3, -1, 1, 2, 1, 2, 0
Offset: 1

Author

Witold Tatkiewicz, Sep 26 2019

Keywords

Comments

Map the positive integers on a 2D grid starting with 1 in top left corner and continue along increasing antidiagonals.
Replace each prime with -1 and each nonprime with the number of primes in adjacent grid cells around it.
If n is the original number, a(n) is the number that replaces it.
This sequence treats prime numbers as "mines" and fills gaps according to the rules of the classic Minesweeper game.
a(n) < 5 (conjectured).
Set of n such that a(n) = 4 is unbounded (conjectured).

Examples

			Consider positive integers distributed on the plane along antidiagonals:
   1  2  4  7 11 16 ...
   3  5  8 12 17 ...
   6  9 13 18 ...
  10 14 19 ...
  15 20 ...
  21 ...
  ...
1 is not prime and in its adjacent grid cells there are 3 primes: 2, 3 and 5. Therefore a(1) = 3.
2 is prime, therefore a(2) = -1.
8 is not prime and in adjacent grid cells there are 4 primes: 2, 5, 7 and 13. Therefore a(8) = 4.
From _Michael De Vlieger_, Oct 01 2019: (Start)
Replacing n with a(n) in the plane described above, and using "." for a(n) = 0 and "*" for negative a(n), we produce a graph resembling Minesweeper, where the mines are situated at prime n:
  3  *  3  *  *  3  2  *  *  2  1  * ...
  *  *  4  4  *  *  3  3  *  2  1  2
  2  4  *  3  3  *  3  2  2  1  1  1
  .  2  *  3  2  2  3  *  3  1  1  *
  .  1  1  2  *  2  3  *  *  2  1  1
  .  1  1  2  3  *  3  3  *  3  1  .
  .  2  *  2  2  *  3  2  3  *  2  1
  .  2  *  2  1  1  2  *  2  1  3  *
  .  1  1  2  1  1  1  2  3  2  3  *
  .  1  1  2  *  2  1  1  *  *  2  2
  .  2  *  3  2  *  1  1  2  2  1  1
  .  2  *  3  2  2  1  1  1  1  .  1
   ...  (End)
		

Crossrefs

Different arrangements of integers:
Cf. A326406 - triangle maze,
Cf. A326407 - square mapping,
Cf. A326408 - square maze,
Cf. A326409 - Hamiltonian path,
Cf. A326410 - Ulam's spiral.

Programs

A326411 Triangle T(n,k) read by rows: T(n,k) = the number of ways of seating n people around a table for the second time so that k pairs are maintained. Reflected and rotated sequences are counted as one.

Original entry on oeis.org

1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2, 0, 1, 1, 0, 5, 5, 0, 1, 3, 12, 15, 20, 9, 0, 1, 23, 70, 112, 91, 49, 14, 0, 1, 177, 544, 740, 640, 302, 96, 20, 0, 1, 1553, 4500, 6003, 4725, 2439, 747, 165, 27, 0, 1, 14963, 41740, 53585, 41420, 20810, 7076, 1550, 260, 35, 0, 1
Offset: 0

Author

Witold Tatkiewicz, Aug 07 2019

Keywords

Comments

Poulet (1919) arrives at this triangle of numbers by considering n-sided polygons whose vertices lie on a circle. Call a side of such a polygon simple if its endpoints are adjacent on the circle. Then T(n,k) is the number of such polygons with k simple sides. There is also a connection with A002464 (see that entry). - N. J. A. Sloane, Mar 08 2022
Definition requires "pairs" and for n=0 it is assumed that there is 1 way of seating 0 people around a table for the second time so that 0 pairs are maintained and 1 person forms only one pair with him/herself. Therefore T(0,0)=1, T(1,0)=0 and T(1,1)=1.
The weighted average of each row using k as weights converges to 2 for large n and appears to be given by (Sum_{k} k*T(n,k))/n! = 2/(n-1) + 2.

Examples

			Assuming the initial order was {1,2,3,4,5} (therefore 1 and 5 form a pair as the first and last persons are neighbors in the case of a round table) there are 5 sets of ways of seating them again so that 3 pairs are conserved: {1,2,3,5,4}, {2,3,4,1,5}, {3,4,5,2,1}, {4,5,1,3,2}, {5,1,2,4,3}. Since within each set we do not allow for circular symmetry (e.g., {1,2,3,5,4} and its rotation to form {2,3,5,4,1} are counted as one) nor reflection ({1,2,3,5,4} and {4,5,3,2,1} are also counted as one), the total number of ways is 5 and therefore T(5,3)=5.
Unfolded table with n individuals (rows) forming k pairs (columns):
    0    1    2    3    4    5    6    7
0   1
1   0    1
2   0    0    1
3   0    0    0    1
4   0    0    2    0    1
5   1    0    5    5    0    1
6   3   12   15   20    9    0   1
7  23   70  112   91   49   14   0   1
		

Crossrefs

Cf. A002816 (column k=0).
Row sums: A001710(n-1) = Sum_k T(n,k).
Cf. also A326390 (accounting for rotation and reflection symmetry), A326397 (disregards reflection symmetry but allows rotation), A326407 (disregards rotation symmetry but allows reflection).
See in addition A002464.

Programs

  • Java
    See Links section
    
  • Maple
    A326411 := proc(n,k)
        option remember;
        if k > n or k < 0 then
            0;
        elif k = n then
            1;
        elif k =0 then
            if n < 5 then
                0 ;
            elif n = 5 then
                1 ;
            elif n = 6 then
                3 ;
            elif n = 7 then
                23 ;
            else
                # Poulet eq (6) page 120, shifted n->n-2
                -(n^3-8*n^2+18*n-21)*procname(n-1,0)
                -4*(n^2-5*n)*procname(n-2,0)
                +2*(n^3-11*n^2+33*n-18)*procname(n-3,0)
                -(n^2-7*n+9)*procname(n-4,0)
                -(n^3-10*n^2+28*n-15)*procname(n-5,0) ;
                -%/(n^2-7*n+9) ;
            end if;
        elif n <= 3 then
            0;
        else
            # Poulet eq (3) page 119
            2*(n-k)*procname(n-1,k-1)/(n-1)+2*k*procname(n-1,k)/(n-1)
                +(k-2)*procname(n-2,k-2)/(n-2) - 2*(k-1)*procname(n-2,k-1)/(n-2) + k*procname(n-2,k)/(n-2) ;
            %*n/k ;
        end if;
    end proc:
    for n from 0 to 12 do
        for k from 0 to n do
            printf("%a ",A326411(n,k)) ;
        end do:
        printf("\n") ;
    end do: # R. J. Mathar, Mar 17 2022
  • Mathematica
    T[n_, k_] := T[n, k] = Which[k > n || k < 0, 0, k == n, 1, k == 0, Which[n<5, 0, n == 5, 1, n == 6, 3, n == 7, 23, True,
        pc = -(n^3 - 8*n^2 + 18*n - 21)*T[n-1, 0]
          - 4*(n^2 - 5*n)*T[n - 2, 0]
          + 2*(n^3 - 11*n^2 + 33*n - 18)*T[n-3, 0]
          - (n^2 - 7*n + 9)*T[n-4, 0]
          - (n^3 - 10*n^2 + 28*n - 15)*T[n-5, 0];
        -pc/(n^2 - 7*n + 9)], n <= 3, 0, True,
       pc = 2*(n-k)*T[n-1, k-1]/(n-1) + 2*k*T[n-1, k]/(n-1) +
         (k - 2)*T[n-2, k-2]/(n-2) -
         2*(k-1)*T[n-2, k-1]/(n-2) + k*T[n-2, k]/(n-2);
        pc*n/k];
    Table[T[n, k], {n, 0, 12}, {k, 0, n}] // Flatten (* Jean-François Alcover, Mar 17 2023, after R. J. Mathar *)
  • PARI
    Q(n,k)={k*subst(serlaplace(polcoef((1 - 2*x -x^2)/((1 + x)*(1 + (1 - y)*x + y*x^2)) + O(x^n), n-1)), y, k)}
    row(n)={Vec(if(n<3, 1, (Q(n,y/(y-1))/2 + (-1)^n)*(y-1)^n), -n-1)} \\ Andrew Howroyd, Mar 01 2024

Formula

It appears that Poulet gives recurrences that generate the whole triangle. - N. J. A. Sloane, Mar 09 2022
T(n,n) = 1;
T(n,n-1) = 0 for n >= 1;
T(n,n-2) = n*(n-3)/2 for n >= 4 [Poulet];
T(n,n-3) = n*(n-4)*(2*n-7)/3 for n >= 4 [Poulet, corrected by N. J. A. Sloane, Mar 09 2022]
T(n,n-4) = (25/24)*n^4 + (23/12)*n^3 - (169/24)*n^2 + (85/12)*n - 3 for n > 5 (conjectured); [see Poulet]
T(n,n-5) = (26/15)*n^5 + (25/6)*n^4 - (83/6)*n^3 + (221/6)*n^2 - (299/10)*n + 13 for n > 5 (conjectured); [see Poulet]
T(n,n-6) = (707/240)*n^6 + (2037/240)*n^5 - (413/16)*n^4 + (2233/16)*n^3 - (2777/15)*n^2 + (3739/20)*n - 57 for n > 6 (conjectured). [See Poulet]

A326404 Triangle T(n,k) read by rows: T(n,k) = number of ways of seating n people around a table for the second time so that k pairs are maintained. Rotated sequences are counted as one.

Original entry on oeis.org

1, 0, 1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 4, 0, 2, 2, 0, 10, 10, 0, 2, 6, 24, 30, 40, 18, 0, 2, 46, 140, 224, 182, 98, 28, 0, 2, 354, 1088, 1480, 1280, 604, 192, 40, 0, 2, 3106, 9000, 12006, 9450, 4878, 1494, 330, 54, 0, 2, 29926, 83480, 107170, 82840, 41620, 14152, 3100, 520, 70, 0, 2
Offset: 0

Author

Witold Tatkiewicz, Aug 01 2019

Keywords

Comments

Definition requires "pairs" and for n=0 it is assumed that there is 1 way of seating 0 people around a table for the second time so that 0 pairs are maintained and 1 person forms only one pair with him/herself. Therefore T(0,0)=1, T(1,0)=0 and T(1,1)=1.
Sum of row n is equal to (n-1)! for n > 1.
Conjecture: The weighted average of each row using k as weights converges to 2 for large n and is given by the following formula: (Sum_{k} T(n,k)*k)/(Sum_{k} T(n,k)) = 2/(n-1) + 2.

Examples

			Assuming the initial order was {1,2,3,4,5} (therefore 1 and 5 form a pair as the first and last persons are neighbors in the case of a round table) there are 5 sets of ways of seating them again so that 3 pairs are conserved: {1,2,3,5,4}, {2,3,4,1,5}, {3,4,5,2,1}, {4,5,1,3,2}, {5,1,2,4,3}. Since within each set we do not allow for circular symmetry (e.g., {1,2,3,5,4} and its rotation to form {2,3,5,4,1} are counted as one) but we allow reflection ({1,2,3,5,4} and {4,5,3,2,1} are considered distinct), the total number of ways is 5*2 and therefore T(5,3)=10.
Unfolded table with n individuals (rows) forming k pairs (columns):
    0    1    2    3    4    5    6    7
0   1
1   0    1
2   0    0    1
3   0    0    0    2
4   0    0    4    0    2
5   2    0   10   10    0    2
6   6   24   30   40   18    0    2
7  46  140  224  182   98   28    0    2
		

Crossrefs

Cf. A078603 (column k=0).
Sum of n-th row is A000142(n-1) for n > 0.
Cf. A326390 (accounting for rotation and reflection symmetry), A326397 (disregards reflection symmetry but allows rotation), A326411 (disregards both reflection and rotation symmetry).

Programs

  • Java
    See Links section

Formula

T(n,n) = 2 for n > 2;
T(n,n-1) = 0 for n > 1.
Conjectures:
T(n,n-2) = n^2 + n - 2 for n > 3;
T(n,n-3) = (4/3)*n^3 + 2*n^2 - (16/3)*n + 2 for n > 4;
T(n,n-4) = (25/12)*n^4 + (23/6)*n^3 - (169/12)*n^2 + (85/6)*n - 6 for n > 5;
T(n,n-5) = (52/15)*n^5 + (25/3)*n^4 - (83/3)*n^3 + (221/3)*n^2 - (299/5)*n + 26 for n > 5;
T(n,n-6) = (707/120)*n^6 + (2037/120)*n^5 - (413/8)*n^4 + (2233/8)*n^3 - (5554/15)*n^2 + (3739/10)*n - 114 for n > 6.

A326397 Triangle T(n,k) read by rows: T(n,k) = number of ways of seating n people around a table for the second time so that k pairs are maintained. Reflected sequences are counted as one.

Original entry on oeis.org

1, 0, 1, 0, 0, 1, 0, 0, 0, 3, 0, 0, 8, 0, 4, 5, 0, 25, 25, 0, 5, 18, 72, 90, 120, 54, 0, 6, 161, 490, 784, 637, 343, 98, 0, 7, 1416, 4352, 5920, 5120, 2416, 768, 160, 0, 8, 13977, 40500, 54027, 42525, 21951, 6723, 1485, 243, 0, 9, 149630, 417400, 535850, 414200, 208100, 70760, 15500, 2600, 350, 0, 10, 1737241, 4691654
Offset: 0

Author

Witold Tatkiewicz, Aug 01 2019

Keywords

Comments

Definition requires "pairs" and for n=0 it is assumed that there is 1 way of seating 0 people around a table for the second time so that 0 pairs are maintained and 1 person forms only one pair with him/herself. Therefore T(0,0)=1, T(1,0)=0 and T(1,1)=1.
Weighted average of each row using k as weights converges to 2 for large n and is given by the following formula: (Sum_{k} T(n,k)*k)/(Sum_{k} T(n,k)) = 2/(n-1) + 2 (conjectured).

Examples

			Assuming the initial order was {1,2,3,4,5} (therefore 1 and 5 form a pair as first and last person are neighbors in case of round table) there are 5 sets of ways of seating them again so that 3 pairs are conserved: {1,2,3,5,4}, {2,3,4,1,5}, {3,4,5,2,1}, {4,5,1,3,2}, {5,1,2,4,3}. Since within each set we allow for rotation ({1,2,3,5,4} and {2,3,5,4,1} are different) but not reflection ({1,2,3,5,4} and {4,5,3,2,1} are counted as one sequence) the total number of ways is 5*5 and therefore T(5,3)=25.
Unfolded table with n individuals (rows) forming k pairs (columns):
    0    1    2    3    4    5    6    7
0   1
1   0    1
2   0    0    1
3   0    0    0    3
4   0    0    8    0    4
5   5    0   25   25    0    5
6  18   72   90  120   54    0   6
7 161  490  784  637  343   98   0   7
		

Crossrefs

Cf. A001710 sum of each row.
Cf. A326390 (with reflection symmetry), A326404 (with reflection symmetry, but disregards circular symmetry), A326411 (disregards both circular and reflection symmetry).

Programs

  • Java
    See Links section.

Formula

T(n,n) = n for n>2.
T(n,n-1) = 0 for n>1.
T(n,n-3) = 1/2*n^3 + 3/4*n^2 - 2 (conjectured);
T(n,n-3) = (2/3)*n^4 + 3*n^3 + (1/3)*n^2 - 7*n + 3 for n > 4 (conjectured);
T(n,n-4) = (25/24)*n^5 + (73/12)*n^4 + (5/8)*n^3 - (253/12)*n^2 + (76/3)*n - 12 for n > 5 (conjectured);
T(n,n-5) = (26/15)*n^6 + (77/6)*n^5 + 7*n^4 - (97/3)*n^3 + (2314/15)*n^2 - 273/2*n + 65 for n > 5 (conjectured);
T(n,n-6) = (707/240)*n^7 + (2093/80)*n^6 + (2009/80)*n^5 - (245/16)*n^4 + (78269/120)*n^3 - (18477/20)*n^2 + (10647/0)*n - 342 for n > 6 (conjectured).

A326390 The number of ways of seating n people around a table for the second time so that k pairs are maintained. T(n,k) read by rows.

Original entry on oeis.org

1, 0, 1, 0, 0, 2, 0, 0, 0, 6, 0, 0, 16, 0, 8, 10, 0, 50, 50, 0, 10, 36, 144, 180, 240, 108, 0, 12, 322, 980, 1568, 1274, 686, 196, 0, 14, 2832, 8704, 11840, 10240, 4832, 1536, 320, 0, 16, 27954, 81000, 108054, 85050, 43902, 13446, 2970, 486, 0, 18, 299260, 834800, 1071700, 828400, 416200, 141520, 31000, 5200, 700, 0, 20
Offset: 0

Author

Witold Tatkiewicz, Jul 03 2019

Keywords

Comments

Definition requires "pairs" and for n=0 it is assumed that there is 1 way of seating 0 people around a table for the second time so that 0 pairs are maintained and 1 person forms only one pair with him/herself. Therefore T(0,0)=1, T(1,0)=0 and T(1,1)=1.
Sum of each row is equal to n!.
Weighted average of each row using k as weights converges to 2 for large n and is given with following formula: (Sum_{k} T(n,k)*k)/n! = 2/(n-1) + 2 (conjectured).

Examples

			Assuming initial order was {1,2,3,4,5} (therefore 1 and 5 forms pair as first and last person are neighbors in case of round table) there are 5 sets of ways of seating them again so that 3 pairs are conserved: {1,2,3,5,4}, {2,3,4,1,5}, {3,4,5,2,1}, {4,5,1,3,2}, {5,1,2,4,3}. Since within each set we allow for rotation ({1,2,3,5,4} and {2,3,5,4,1} are different) and reflection ({1,2,3,5,4} and {4,5,3,2,1} are also different) the total number of ways is 5*2*5 and therefore T(5,3)=50.
Unfolded table with n individuals (rows) forming k pairs (columns):
    0    1    2    3    4    5    6    7
0   1
1   0    1
2   0    0    2
3   0    0    0    6
4   0    0   16    0    8
5  10    0   50   50    0   10
6  36  144  180  240  108    0   12
7 322  980 1568 1274  686  196    0   14
		

Crossrefs

Cf. A089222 (column k=0).
Cf. A000142 sum of each row.
Cf. A326397 (disregards reflection symmetry), A326404 (disregards circular symmetry), A326411 (disregards both circular and reflection symmetry).

Programs

  • Java
    See Links section

Formula

T(n,n) = 2*n for n > 2;
T(n,n-1) = 0 for n > 1;
T(n,n-2) = n^2*(n-3) for n > 3 (conjectured);
T(n,n-3) = (3/4)*n^4 + 6*n^3 + (2/3)*n^2 - 14*n + 6 for n > 4 (conjectured);
T(n,n-4) = (25/12)*n^5 + (73/6)*n^4 + (5/4)*n^3 - (253/6)*n^2 + (152/3)*n - 24 for n > 5 (conjectured);
T(n,n-5) = (52/15)*n^6 + (77/3)*n^5 + 14*n^4 - (194/3)*n^3 + (4628/15)*n^2 - 273*n + 130 for n > 5 (conjectured);
T(n,n-6) = (707/120)*n^7 + (2093/40)*n^6 + (2009/40)*n^5 - (245/8)*n^4 + (78269/60)*n^3 - (18477/10)*n^2 + (21294/10)*n - 684 for n > 6 (conjectured).