%I #38 Aug 20 2021 03:34:00
%S 1,0,1,2,4,16,80,288,1728,12096,67392,525312,4783104,35942400,
%T 349056000,3891456000,36910080000,429981696000,5667397632000,
%U 64963067904000,883878137856000,13437405757440000,180681897811968000,2813727217287168000,48450827875516416000
%N a(n) is the number of permutations pi on n letters such that pi(i) != i (mod 3) for all i.
%C a(n) is the permanent of the n X n matrix given by f(i,j) = ((i-j)^2 mod 3).
%H Vaclav Kotesovec, <a href="/A340900/b340900.txt">Table of n, a(n) for n = 0..35</a> (terms 0..33 from Pontus von Brömssen)
%F a(3*n) = A204436(3*n) = A204438(3*n) = A204440(3*n),
%F a(3*n+1) = A204438(3*n+1), and
%F a(3*n+2) = A204436(3*n+2).
%e For n = 4, the a(4) = 4 allowable permutations (read as words) are
%e (2,4,1,3),
%e (2,1,4,3),
%e (3,4,1,2), and
%e (3,1,4,2).
%e These are all of the permutations in S_4 subject to the restriction that the first letter cannot be 1 or 4, the second letter cannot be 2, the third letter cannot be 3, and the fourth letter cannot be 1 or 4.
%t contingency[n_] := Table[Mod[(i - j)^2, 3], {i, 1, n}, {j, 1, n}];
%t a[0] := 1;
%t a[n_] := Permanent[contingency[n]];
%o (PARI) a(n) = matpermanent(matrix(n, n, i, j, (i-j)^2 % 3)); \\ _Michel Marcus_, Jan 27 2021
%Y Analogous sequences: A204436 (pi(i) + i != 0), A204438 (pi(i) + i != 2), A204440 (pi(i) + i != 1).
%K nonn
%O 0,4
%A _Peter Kagey_, Jan 25 2021
%E a(23)-a(24) from _Alois P. Heinz_, Jan 27 2021
|