|
|
A334830
|
|
a(n) is the number of permutations of length n that have the same number of fixed points whether forwards or backwards.
|
|
0
|
|
|
1, 1, 0, 0, 14, 46, 200, 1496, 11718, 111558, 1052272, 12261712, 140348300, 1915312460, 25732919088, 402510985872, 6210501292870, 109537725353798, 1908681625474400, 37475105645783072, 727818914470269924, 15743598127274107044, 337206399213040703920
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,5
|
|
COMMENTS
|
Relevant to the "matching problem" in combinatorics: For a random permutation of the integers 1 through n, what is the expected number of elements in the permutation equal to their respective order in the permutation?
If m(P[n]) is a function that returns the number of matches for a particular permutation P of the integers 1 through n, and -P[n] is P[n] backward, then a(n) answers the question, "For how many permutations P[n] does m(P[n]) = m(-P[n])?"
Equivalently, the probability that m(P[n]) = m(-P[n]) for a random permutation of length n equals a(n)/n!.
Also relevant to the null hypothesis statistical test (NHST) called the matching method, used to evaluate the experimental hypothesis that two nominal or ordinal populations are mutually independent.
A simplified version of this sequence is "the number of distinct permutations...", where reversing the order of elements does not create a distinct permutation. Each element in the simplified sequence after n = 1 is half of a(n). However, this sequence no longer has the property that a(n)/n! is the probability that m(P[n]) = m(-P[n]) for a random permutation of length n.
|
|
REFERENCES
|
G. W. Allport and P. Vernon, Studies in expressive movement. New York: Macmillan, 1933.
|
|
LINKS
|
|
|
EXAMPLE
|
Permutations and their reversals for n = 3: {1, 2, 3}, {3, 2, 1}; {1, 3, 2}, {2, 3, 1}; {2, 1, 3}, {3, 1, 2}; {2, 3, 1}, {1, 3, 2}; {3, 1, 2}, {2, 1, 3}; {3, 2, 1}, {1, 2, 3}. Total number of elements for which the i-th element equals i: 3, 1; 1, 0; 1, 0; 0, 1; 0, 1; 1, 3. a(3) = 0.
|
|
MAPLE
|
b:= proc(s, i, t) option remember; (n-> `if`(n=0, 1, add(
(h-> `if`(abs(h)<n, b(s minus {j}, i+1, h), 0))(t+
`if`(j=i, 1, 0)-`if`(j=n, 1, 0)), j=s)))(nops(s))
end:
a:= n-> b({$1..n}, 1, 0):
|
|
MATHEMATICA
|
b[s_, i_, t_] := b[s, i, t] = Function[n, If[n == 0, 1, Sum[Function[h, If[Abs[h]<n, b[s ~Complement~ {j}, i + 1, h], 0]][t + If[j == i, 1, 0] - If[j == n, 1, 0]], {j, s}]]][Length[s]];
a[n_] := b[Range[n], 1, 0];
|
|
PROG
|
(R)
AT<-function(T){ #Returns a(n)
perm<-function(v){ #Returns all n! P[n]
n <- length(v)
if (n == 1) v
else{
X <- NULL
for (i in 1:n) X <- rbind(X, cbind(v[i], perm(v[-i])))
X}}
PN<-perm(1:T) #All P[n]
FN<-factorial(T)
PNn<-NULL
for (i in T:1){
PNn<-cbind(PNn, PN[, i])} #All -P[n]
PNO<-NULL
for (j in 1:T){
PNO<-cbind(PNO, rep(j, FN))} #Order
PNM<-matrix(0, FN, 2)
for (k in 1:FN){
PNM[k, 1]<-sum(PNO[k, ]==PN[k, ]) #m(P)
PNM[k, 2]<-sum(PNO[k, ]==PNn[k, ])}#m(-P)
return(sum(PNM[, 1]==PNM[, 2]))} #Sum{m(P[n]) = m(-P[n])}
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|