login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


Number of permutations of length n such that at least one absolute difference between consecutive elements has a distinct partner.
2

%I #13 Jan 31 2020 10:42:25

%S 0,0,2,20,112,696,5008,40280,362760,3628504,39916152,479000272,

%T 6227017600,87178281288,1307674342408,20922789832080,355687427952808,

%U 6402373705217304,121645100407380704,2432902008173142656,51090942171698988176,1124000727777569109296

%N Number of permutations of length n such that at least one absolute difference between consecutive elements has a distinct partner.

%H Jean-François Alcover, <a href="/A084894/b084894.txt">Table of n, a(n) for n = 1..40</a>

%F a(n) = n! - A006967(n).

%e a(3)=2 as only 123 and 321 have the required property, with differences of 1,1. The rest all have differences of 1,2.

%t A006967 = Cases[Import["https://oeis.org/A006967/b006967.txt", "Table"], {_, _}][[All, 2]];

%t a[n_] := n! - A006967[[n+1]];

%t a /@ Range[40] (* _Jean-François Alcover_, Jan 31 2020 *)

%o (PARI) { for (n=3,10,x=vector(n-1); s=0; for (i=1,n!,v=numtoperm(n,i); for (j=1,n-1,x[j]=abs(v[j+1]-v[j])); x=vecsort(x); fl=0; for (k=1,n-2,if (x[k]==x[k+1],fl=1; break)); if (fl==1,s++)); print(n"; "s)) }

%Y Cf. A000142, A006967.

%K nonn

%O 1,3

%A _Jon Perry_, Jun 10 2003

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 24 03:28 EDT 2024. Contains 376185 sequences. (Running on oeis4.)