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.

A277256 Multi-table menage numbers T(n,k) for n,k >= 1 equals the number of ways to seat the gentlemen from n*k married couples at n round tables with 2*k seats each such that (i) the gender of persons alternates around each table; and (ii) spouses do not sit next to each other; provided that the ladies are already properly seated (i.e., no two ladies sit next to each other).

Original entry on oeis.org

0, 1, 0, 2, 4, 1, 9, 80, 82, 2, 44, 4752, 43390, 4740, 13, 265, 440192, 59216968, 59216648, 439794, 80, 1854, 59245120, 164806652728, 2649391488016, 164806435822, 59216644, 579, 14833, 10930514688, 817056761525488, 312400218967336992, 312400218673012936, 817056406224656, 10927434466, 4738
Offset: 1

Views

Author

Max Alekseyev, Oct 07 2016

Keywords

Examples

			Table T(n,k):
  n=1:  0,      0,            1,                  2, ...
  n=2:  1,      4,           82,               4740, ...
  n=3:  2,     80,        43390,           59216648, ...
  n=4:  9,   4752,     59216968,      2649391488016, ...
  n=5: 44, 440192, 164806652728, 312400218967336992, ...
  ...
		

Crossrefs

Cf. A000179 (row n=1), A000166 (column k=1), A000316 (column k=2), A277257, A277265, A341439.

Programs

  • PARI
    { A277256(n,k) = my(m,s,g); m=n*k; s=sqrt(1+4*x+O(x^(m+1))); g=if(k==1,1+z,((1-s)/2)^(2*k)+((1+s)/2)^(2*k))^n; sum(j=0,m,(-1)^j*polcoeff(g,j)*(m-j)!); }

Formula

T(n,k) = Sum_{j=0..n*k} (-1)^j * (n*k-j)! * [z^j] F(k,z)^n, where F(1,z) = 1+z and F(k,z) = ((1-sqrt(1+4*z))/2)^(2*k) + ((1+sqrt(1+4*z))/2)^(2*k) for k >= 2. [Corrected by Pontus von Brömssen, Jun 01 2022]
T(n,k) = A341439(n,n*k). - Pontus von Brömssen, May 31 2022

A354408 Triangle read by rows of generalized ménage numbers: T(n,k) is the number of permutations pi in S_n such that pi(i) != i and pi(i) != i+k (mod n) for all i; n, 1 <= k < n.

Original entry on oeis.org

0, 1, 1, 2, 4, 2, 13, 13, 13, 13, 80, 82, 80, 82, 80, 579, 579, 579, 579, 579, 579, 4738, 4740, 4738, 4752, 4738, 4740, 4738, 43387, 43387, 43390, 43387, 43387, 43390, 43387, 43387, 439792, 439794, 439792, 439794, 440192, 439794, 439792, 439794, 439792
Offset: 2

Views

Author

Peter Kagey, May 25 2022

Keywords

Comments

Conjectures: (Start)
T(n,1) <= T(n,k) for all 1 < k < n.
With the exception of T(6,3) = 80, T(n,k) > T(n,1) whenever gcd(n,k) > 1. (End)

Examples

			Triangle begins:
  n\k|     1     2     3     4     5     6     7     8
-----+------------------------------------------------
   2 |     0
   3 |     1     1
   4 |     2     4     2
   5 |    13    13    13    13
   6 |    80    82    80    82    80
   7 |   579   579   579   579   579   579
   8 |  4738  4740  4738  4752  4738  4740  4738
   9 | 43387 43387 43390 43387 43387 43390 43387 43387
  ...
		

Crossrefs

Cf. A277256, A341439, A354409 (record values in rows).
Cf. A000179 (column 1), A354152 (column 2).

Programs

  • Python
    from sympy import Matrix
    def A354408(n,k):
        return Matrix(n,n,lambda i,j:int(i!=j and i!=(j+k)%n)).per() # Pontus von Brömssen, May 31 2022
    
  • Python
    # This version, based on the formula in A277256, is much faster than the version using permanents, at least for large n.
    from sympy import factorial,gcd,sqrt
    from sympy.abc import z
    def A354408(n,k):
        k=gcd(n,k)
        F=((1-sqrt(1+4*z))/2)**(2*(n//k))+((1+sqrt(1+4*z))/2)**(2*(n//k))
        p=(F**k).series(z,0,n+1)
        return sum((-1)**j*factorial(n-j)*p.coeff(z,j) for j in range(n+1)) # Pontus von Brömssen, Jun 02 2022

Formula

T(n,1) = A000179(n).
T(n,k) = T(n,n-k).
T(n,k) = A341439(k,n).
T(n,k) = A000179(n) if k is coprime to n.
T(n,j) = T(n,k) if gcd(n,j) = gcd(n,k). - Pontus von Brömssen, May 30 2022
Conjecture: T(n,j) < T(n,k) if gcd(n,j) < gcd(n,k) and (n,k) != (6,3). - Pontus von Brömssen, May 31 2022

A354152 a(n) is the number of permutations pi in S_n such that pi(i) - i != 1 (mod n) and pi(i) - i != -1 (mod n) for all i.

Original entry on oeis.org

1, 0, 1, 1, 4, 13, 82, 579, 4740, 43387, 439794, 4890741, 59216644, 775596313, 10927434466, 164806435783, 2649391469060, 45226435601207, 817056406224418, 15574618910994665, 312400218671253764, 6577618644576902053, 145051250421230224306, 3343382818203784146955
Offset: 0

Views

Author

Peter Kagey, May 27 2022

Keywords

Comments

For n > 1, this is the number of ways of rearranging guests sitting at a circular table such that a guest may stay in the same seat, but cannot move exactly one seat to their left or right.
The recurrence comes from Doron Zeilberger's MENAGE program, available via the arXiv reference.

Examples

			For n = 5, the a(5) = 13 permutations are 12345, 12543, 14325, 14523, 15342, 32145, 34125, 34512, 35142, 42315, 42513, 45123, and 45312.
The first letter is never 2 or 5, the second letter is never 1 or 3, the third letter is never 2 or 4, the fourth letter is never 3 or 5 and the fifth letter is never 1 or 4.
		

Crossrefs

Formula

a(n) = n*a(n-1) + 3*a(n-2) + (-2n+6)*a(n-3) - 3*a(n-4) + (n-6)*a(n-5) + a(n-6) for n > 8.
a(2k+1) = A000179(2k+1) for k > 1.
Conjecture: a(2k) = A000179(2k) + 2 for k > 1.
Showing 1-3 of 3 results.