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.
%I A258338 #24 Dec 03 2018 03:21:15 %S A258338 0,8,84,3456,219120,19281600,2324085120,370554347520,74897768655360, %T A258338 18761274367718400,5708008284647961600,2072453585852572876800, %U A258338 885341762559654194995200,439630143301970662603161600,251099117378080818090596352000,163464570058143774978660630528000 %N A258338 Ternary ménage problem: number of seating arrangements for n opposite-sex couples around a circular table such that no spouses and no triples of the same sex seat next to each other. Seats are labeled. %C A258338 Conjecture: (a(n)/n!^2)^(1/n) ~ (3+sqrt(5))/2. - _Vaclav Kotesovec_, May 29 2015 %H A258338 Max Alekseyev, <a href="/A258338/b258338.txt">Table of n, a(n) for n = 1..100</a> %H A258338 M. A. Alekseyev, Weighted de Bruijn Graphs for the Menage Problem and Its Generalizations. Lecture Notes in Computer Science 9843 (2016), 151-162. doi:<a href="http://doi.org/10.1007/978-3-319-44543-4_12">10.1007/978-3-319-44543-4_12</a>; arXiv:<a href="http://arxiv.org/abs/1510.07926">1510.07926</a> [math.CO], 2015-2016. %F A258338 a(n) = A114939(n) * 4 * n. %t A258338 a[1] = 0; %t A258338 a[n_] := n! Sum[(-1)^j (n-j)! SeriesCoefficient[ SeriesCoefficient[ Tr[ MatrixPower[{{0, 1, 0, y^2, 0, 0}, {z y^2, 0, 1, 0, y^2, 0}, {z y^2, 0, 0, 0, y^2, 0}, {0, 1, 0, 0, 0, z}, {0, 1, 0, y^2, 0, z}, {0, 0, 1, 0, y^2, 0}}, 2n]], {y, 0, 2n}], {z, 0, j}], {j, 0, n}]; %t A258338 Array[a, 16] (* _Jean-François Alcover_, Dec 03 2018, from 1st PARI program *) %o A258338 (PARI) { a(n) = if(n<2, 0, n! * sum(j=0,n, (-1)^j * (n-j)! *polcoeff( polcoeff( trace([0, 1, 0, y^2, 0, 0; z*y^2, 0, 1, 0, y^2, 0; z*y^2, 0, 0, 0, y^2, 0; 0, 1, 0, 0, 0, z; 0, 1, 0, y^2, 0, z; 0, 0, 1, 0, y^2, 0]^(2*n)), 2*n,y) ,j,z)) ); } %o A258338 (PARI) { a(n) = if(n<2, 0, n! * polcoeff( serlaplace( polcoeff( trace([-y, z*y, z, 0, z*y, -y; -y, (z - 1)*y, 0, (z - 1)*y^2, z*y, -y; 0, (z - 1)*y, 0, (z - 1)*y^2, 0, -y; -y, 0, z - 1, 0, (z - 1)*y, 0; -y, z*y, z - 1, 0, (z - 1)*y, -y; -y, z*y, 0, z*y^2, z*y, -y]^n), n, y) )/(1-z) + O(z^(n+1)), n, z) ) } %Y A258338 Cf. A114939 (counts up to rotations and reflections) %Y A258338 Cf. A059375, A094047, A000179, A114938, A137729, A137730, A137737, A137749. %K A258338 nonn %O A258338 1,2 %A A258338 _Max Alekseyev_, May 27 2015