The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation. Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 56th year, we are closing in on 350,000 sequences, and we’ve crossed 9,700 citations (which often say “discovered thanks to the OEIS”). Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A209036 Number of permutations of the multiset {1,1,2,2,....,n,n} with exactly  two consecutive equal terms. 0

%I

%S 1,2,36,984,43800,2868480,259554960,31012490880,4728875800320,

%T 896042510496000,206523228759724800,56893926736333209600,

%U 18461230471787348044800,6968851610446509386803200

%N Number of permutations of the multiset {1,1,2,2,....,n,n} with exactly two consecutive equal terms.

%C This is a particular case (p = 1) of the more general: a(p,n) = number of permutations of the multiset {1,1,2,2,....,n,n} with exactly p times two consecutive equal terms. The sequence a(0,p) is A114938.

%F a(1,1) = 1; a(p,n+1) = a[p, n + 1] = (2*n - p + 2)*a[p-1, n] + (2*n - p + 1)*(2*n - p)*a[p, n]/2 + p*a[p, n] + (p + 1)*(2*n - p)*a[p + 1, n + (p + 2)*(p + 1)*a[p + 2, n]/2.

%e a(1,2) = 2, because 1221 and 2112 are the only permutations of {1,1,2,2} where exactly two consecutive terms are equal.

%o C-Language :

%o for (p = 0; p < 20; p++)

%o a[p] = 0;

%o for (n = 0; n < 20; n++)

%o a[n] = 0;

%o a = 1;

%o for (n = 0; n < 18; n++)

%o for (p = 0; p < 18; p++)

%o a[p+1][n + 1] = (2*n - p + 2)*a[p][n] + (2*n - p + 1)*(2*n - p)*a[p+1][n]/2 + p*a[p+1][n] + (p + 1)*(2*n - p)*a[p + 2][n] + (p + 2)*(p + 1)*a[p + 3][n]/2 ;

%o for(n = 0; n < 10; n++)

%o {

%o printf("%d, %ld ", n, a[n]);

%o if (n % 5 == 0)

%o printf("\n\n");

%o }

%Y Cf. A114938 (a(0,n)).

%K nonn

%O 1,2

%A _Philippe Gibone_, Mar 04 2012

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

Last modified December 7 12:17 EST 2021. Contains 349581 sequences. (Running on oeis4.)