login

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 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A235320
The number of length n sequences on {0,1,2} such that there are an equal number of 0's and 1's or there are an equal number of 0's and 2's.
1
1, 2, 6, 8, 38, 102, 192, 786, 2214, 4598, 17906, 51306, 112928, 425882, 1232454, 2818458, 10393254, 30269862, 71152482, 257993706, 754758738, 1811628498, 6482271054, 19026456246, 46431160992, 164353672602, 483626452302, 1196266880906, 4196480707814
OFFSET
0,2
LINKS
FORMULA
For n congruent to 0 mod 3 a(n) = 2*A002426(n) - n!/floor(n/3)!^3.
For n congruent to 1 or 2 mod 3 a(n) = 2*A002426(n).
EXAMPLE
a(3) = 8 because we have: 012, 021, 102, 111, 120, 201, 210, 222.
MAPLE
a:= proc(n) option remember; `if`(n<6, [1, 2, 6, 8, 38, 102][n+1],
((n-1)^2*(380713*n^2-2450435*n+3831534) *a(n-1)
-3*(n-2)^2*(230459*n^2-1671772*n+2280969) *a(n-2)
-(811908*n^4-11125602*n^3+47672874*n^2-84737610*n+54621270) *a(n-3)
-27*(n-2)*(n-3)*(380713*n^2-2450435*n+3831534) *a(n-4)
+81*(n-3)*(n-4)*(230459*n^2-1671772*n+2280969) *a(n-5)
+243*(n-3)*(n-4)*(n-5)*(120233*n-220828) *a(n-6)) /
(n^2*(n-1)*(10007*n+17779)))
end:
seq(a(n), n=0..40); # Alois P. Heinz, Jan 05 2014
MATHEMATICA
Table[2Sum[Multinomial[k, k, n-2k], {k, 0, Floor[n/2]}], {n, 0, 30}]-Riffle[Riffle[Table[Multinomial[n, n, n], {n, 0, 10}], 0], 0, 3]
CROSSREFS
Cf. A002426 comment by Dennis P. Walsh.
Sequence in context: A076507 A117542 A045653 * A152158 A291782 A327271
KEYWORD
nonn,easy
AUTHOR
Geoffrey Critzer, Jan 05 2014
STATUS
approved