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.

A283184 a(n) is the number of symmetric permutations (p(1),p(2),...,p(m)) of (1,2,...,m), m=2n or m=2n+1, with p(m+1-k) = m+1-p(k) for 1<=k<=m, such that adjacent numbers do not differ by 1. a(n) is also the number of point-symmetric arrangements of m non-attacking kings on an m X m board, with one in each row and column.

Original entry on oeis.org

1, 0, 2, 14, 122, 1262, 15466, 219646, 3551194, 64431374, 1296712778, 28672204574, 691007296954, 18029138380846, 506320912190506, 15228632768870462, 488405396197019546, 16638380026019579726, 600022595692147574794, 22836184629309211495774, 914717041435012519583098
Offset: 0

Views

Author

Gerhard Kirchner, Mar 02 2017

Keywords

Comments

For m=2n+1 the symmetry requires p(n+1)=n+1. That is why the number of permutations is the same for m=2n and m=2n+1.
The n-th element of any permutation is not allowed to be n because otherwise the next element would be n+1. Because of the symmetry it is sufficient to consider the first n elements. Any such n-tuple can be created by a permutation of length n, last element smaller than n: Each element b(k) > n has to be replaced by m+1-b(k).
Example m=6: Original symmetric permutation 536142, 3-tuple 536 created by 231: 5 is replaced by 7-5 and 6 by 7-6.
How many such n-tuples can be created by a n-permutation?
Let us analyze the example above: There are two pairs of adjacent numbers (23 and 31) in the permutation 231. The difference of the first pair is 1, so either 2 or 3 must be replaced, whereas the second pair represents a "gap" (difference > 1), so that 1 can be kept or replaced by 6.
This way, 231 creates four 3-tuples: 531, 241, 536, 246.
Let generally g be the number of gaps in a n-permutation (0<=g<=n-1). Then the number of related n-tuples is 2^(g+1) because the first element of the permutation and each element behind a gap can be arbitrarily replaced or not. On the other hand, when the first element of a section between successive gaps is selected, there is no choice for the replacement of the other elements.
When q is a n-permutation, the number of gaps is g(q) = Sum_{j=1..n-1} sign(|p(j+1)-p(j)|-1). (sign = signum)
The extension up to n=50 was done by a new algorithm, see link "Fast recurrence". - Gerhard Kirchner, Mar 17 2017

Examples

			Example 1, m=5:
The matrix, transforming 12345 into 41352, can also be thought of as a chessboard; each "1" is a king.
./0 0 0 1 0\  /1\ /4\
| 1 0 0 0 0 | |2| |1|
| 0 0 1 0 0 |*|3|=|3|
| 0 0 0 0 1 | |4| |5|
.\0 1 0 0 0/  \5/ \2/
Example 2, m=6:
q is a 3-permutation not ending on 3:
q   g(q)  2^(g(q)+1) Symmetric 6-permutations, |p(j+1)-p(j)|>1
132   1        4        135246, 635241, 142536, 642531
231   1        4        531642, 536142, 241635, 246135
312   1        4        315264, 362514, 462513, 415263
321   0        2        426153, 351624
Result: a(3)=14.
		

Crossrefs

Cf. A002464.

Programs

  • Maple
    b:= proc(n, s, l) option remember; `if`(s={},
         `if`(abs(n/2-l)<1, 0, 1), add(add(`if`(abs(j-l)=1, 0,
            b(n, s minus {i}, i)), j=[i, n-i]), i=s))
        end:
    a:= n-> b(2*n+1, {$1..n}, -1):
    seq(a(n), n=0..10);  # Alois P. Heinz, Mar 15 2017
    # second Maple program:
    a:= proc(n) option remember; `if`(n<4, (n-1)*
          (7*n^2-5*n-6)/6, (2*n+1)*a(n-1) -(2*n-5)*
          (a(n-2)+a(n-3)) +(2*n-6)*a(n-4))
        end:
    seq(a(n), n=0..20);  # Alois P. Heinz, Mar 17 2017
  • Mathematica
    a[n_] := a[n] = If[n<4, (n-1)*(7n^2-5n-6)/6, (2n+1)*a[n-1] - (2n-5)*(a[n-2] + a[n-3]) + (2n-6)*a[n-4]]; Table[a[n], {n, 0, 20}] (* Jean-François Alcover, Mar 18 2017, after Alois P. Heinz *)
  • PARI
    a(n)={subst(serlaplace(polcoef((1 - x)/(1 + (1 - 2*y)*x + 2*y*x^2) + O(x*x^n), n)), y, 1)} \\ Andrew Howroyd, Mar 01 2024

Formula

Let q be any permutation (p(1), p(2),..., p(n)) with p(n) < n and g(q) = Sum_{j=1..n-1} sgn(|p(j+1)-p(j)|-1).
a(n) = Sum_{each q} 2^(g(q)+1).
a(n) ~ exp(-1) * 2^n * n!. - Vaclav Kotesovec, Apr 20 2017

Extensions

a(14)-a(20) from Alois P. Heinz, Mar 15 2017