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.
%I A209036 #8 Jan 13 2025 05:45:23 %S A209036 1,2,36,984,43800,2868480,259554960,31012490880,4728875800320, %T A209036 896042510496000,206523228759724800,56893926736333209600, %U A209036 18461230471787348044800,6968851610446509386803200 %N A209036 Number of permutations of the multiset {1,1,2,2,....,n,n} with exactly two consecutive equal terms. %C A209036 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 A209036 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 A209036 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 A209036 (C) %o A209036 for (p = 0; p < 20; p++) %o A209036 a[p][0] = 0; %o A209036 for (n = 0; n < 20; n++) %o A209036 a[0][n] = 0; %o A209036 a[1][0] = 1; %o A209036 for (n = 0; n < 18; n++) %o A209036 for (p = 0; p < 18; p++) %o A209036 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 A209036 for(n = 0; n < 10; n++) %o A209036 { %o A209036 printf("%d, %ld ", n, a[2][n]); %o A209036 if (n % 5 == 0) %o A209036 printf("\n\n"); %o A209036 } %Y A209036 Cf. A114938 (a(0,n)). %K A209036 nonn %O A209036 1,2 %A A209036 _Philippe Gibone_, Mar 04 2012