A238977 Number of ballot sequences of length n with exactly 2 fixed points.
0, 0, 1, 1, 3, 8, 24, 74, 246, 848, 3088, 11644, 45844, 186336, 784928, 3403128, 15212744, 69802944, 328988096, 1587831568, 7848954928, 39651793024, 204691645824, 1078028406176, 5790745961568, 31687186373888, 176575788105984, 1001061518465984, 5771865641210176
Offset: 0
Examples
a(2) = 1: [1,2]. a(3) = 1: [1,2,1]. a(4) = 3: [1,2,1,1], [1,2,1,2], [1,2,1,3]. a(5) = 8: [1,2,1,1,1], [1,2,1,1,2], [1,2,1,1,3], [1,2,1,2,1], [1,2,1,2,3], [1,2,1,3,1], [1,2,1,3,2], [1,2,1,3,4].
Links
- Joerg Arndt and Alois P. Heinz, Table of n, a(n) for n = 0..800
- Wikipedia, Young tableau
Programs
-
Maple
a:= proc(n) option remember; `if`(n<3, n*(n-1)/2, ((3*n^2+3*n-33)*a(n-1) +(n-4)*(10*n^2-27*n-6)*a(n-2) +(n-4)*(n-5)*(7*n-18)*a(n-3)) / (10*n^2-64*n+105)) end: seq(a(n), n=0..40);
-
Mathematica
b[n_, l_List] := b[n, l] = If[n <= 0, 1, b[n - 1, Append[l, 1]] + Sum[If[i == 1 || l[[i - 1]] > l[[i]], b[n - 1, ReplacePart[l, i -> l[[i]] + 1]], 0], {i, 1, Length[l]}]]; a[n_] := b[n - 3, {2, 1}]; a[0] = a[1] = 0; Table[Print["a(", n, ") = ", an = a[n]]; an, {n, 0, 40}] (* Jean-François Alcover, Feb 06 2015, after Maple *)
Formula
See Maple program.
a(n) ~ sqrt(2)/6 * exp(sqrt(n)-n/2-1/4) * n^(n/2) * (1 + 7/(24*sqrt(n))). - Vaclav Kotesovec, Mar 07 2014
Recurrence (for n>=4): (n-3)*(n^2 - 6*n + 11)*a(n) = (n^3 - 9*n^2 + 32*n - 39)*a(n-1) + (n-4)*(n-2)*(n^2 - 4*n + 6)*a(n-2). - Vaclav Kotesovec, Mar 08 2014
From Peter Bala, Oct 05 2021: (Start)
a(n) = (1/3)*Sum_{k = 0..floor(n/2)} (1 - binomial(n-2*k,3)/binomial(n,3))* binomial(n,2*k) * (2*k)!/(2^k*k!) for n >= 3.
Conjecture: a(n+3) == 1 (mod n) iff n is coprime to 2 and 3, that is, iff n is a term of A007310. (End)
Comments