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.

A306512 Number A(n,k) of permutations p of [n] having no index i with |p(i)-i| = k; square array A(n,k), n>=0, k>=0, read by antidiagonals.

This page as a plain text file.
%I A306512 #41 Sep 01 2021 16:12:36
%S A306512 1,1,0,1,1,1,1,1,1,2,1,1,2,2,9,1,1,2,3,5,44,1,1,2,6,9,21,265,1,1,2,6,
%T A306512 14,34,117,1854,1,1,2,6,24,53,176,792,14833,1,1,2,6,24,78,265,1106,
%U A306512 6205,133496,1,1,2,6,24,120,362,1554,8241,55005,1334961
%N A306512 Number A(n,k) of permutations p of [n] having no index i with |p(i)-i| = k; square array A(n,k), n>=0, k>=0, read by antidiagonals.
%H A306512 Alois P. Heinz, <a href="/A306512/b306512.txt">Antidiagonals n = 0..45, flattened</a>
%H A306512 Wikipedia, <a href="https://en.wikipedia.org/wiki/Permutation">Permutation</a>
%F A306512 A(n,k) = n! - A306506(n,k).
%F A306512 A(n,n+i) = n! for i >= 0.
%e A306512 A(4,0) = 9: 2143, 2341, 2413, 3142, 3412, 3421, 4123, 4312, 4321.
%e A306512 A(4,1) = 5: 1234, 1432, 3214, 3412, 4231.
%e A306512 A(4,2) = 9: 1234, 1243, 1324, 2134, 2143, 2341, 4123, 4231, 4321.
%e A306512 Square array A(n,k) begins:
%e A306512      1,   1,    1,    1,    1,    1,    1,    1, ...
%e A306512      0,   1,    1,    1,    1,    1,    1,    1, ...
%e A306512      1,   1,    2,    2,    2,    2,    2,    2, ...
%e A306512      2,   2,    3,    6,    6,    6,    6,    6, ...
%e A306512      9,   5,    9,   14,   24,   24,   24,   24, ...
%e A306512     44,  21,   34,   53,   78,  120,  120,  120, ...
%e A306512    265, 117,  176,  265,  362,  504,  720,  720, ...
%e A306512   1854, 792, 1106, 1554, 2119, 2790, 3720, 5040, ...
%p A306512 A:= proc(n, k) option remember; `if`(k>=n, n!, LinearAlgebra[
%p A306512       Permanent](Matrix(n, (i, j)-> `if`(abs(i-j)=k, 0, 1))))
%p A306512     end:
%p A306512 seq(seq(A(n, d-n), n=0..d), d=0..12);
%p A306512 # second Maple program:
%p A306512 b:= proc(s, k) option remember; (n-> `if`(n=0, 1, add(
%p A306512       `if`(abs(i-n)=k, 0, b(s minus {i}, k)), i=s)))(nops(s))
%p A306512     end:
%p A306512 A:= (n, k)-> `if`(k>=n, n!, b({$1..n}, k)):
%p A306512 seq(seq(A(n, d-n), n=0..d), d=0..12);
%t A306512 A[n_, k_] := If[k > n, n!, Permanent[Table[If[Abs[i-j] == k, 0, 1], {i, 1, n}, {j, 1, n}]]]; A[0, 0] = 1;
%t A306512 Table[A[n, d-n], {d, 0, 12}, {n, 0, d}] // Flatten (* _Jean-François Alcover_, Feb 05 2021, from first Maple program *)
%t A306512 b[s_, k_] := b[s, k] = With[{n = Length[s]}, If[n == 0, 1, Sum[
%t A306512      If[Abs[i-n] == k, 0, b[s ~Complement~ {i}, k]], {i, s}]]];
%t A306512 A[n_, k_] := If[k >= n, n!, b[Range@n, k]];
%t A306512 Table[A[n, d-n], {d, 0, 12}, {n, 0, d}] // Flatten (* _Jean-François Alcover_, Sep 01 2021, from second Maple program *)
%Y A306512 Columns k=0-3 give: A000166, A078480, A306523, A324365.
%Y A306512 A(n+2j,n+j) (j=0..5) give: A000142, A001564, A001688, A023043, A023045, A023047.
%Y A306512 A(2n,n) gives A306535.
%Y A306512 Cf. A306506.
%K A306512 nonn,tabl
%O A306512 0,10
%A A306512 _Alois P. Heinz_, Feb 20 2019