%I #23 Jul 19 2017 19:50:30
%S 1,2,30,560,11550,252252,5717712,133024320,3155170590,75957810500,
%T 1850332263780,45508998487680,1128243920840400,28159366024288800,
%U 706857555303576000,17831659928458210560,451781821468671694110,11489952898943726476500,293206575828601020085500
%N Number of words either empty or beginning with the first letter of the ternary alphabet, where each letter of the alphabet occurs n times.
%C Also the number of (n*k-1)-step walks on k-dimensional cubic lattice from (1,0,...,0) to (n,n,...,n) with positive unit steps in all dimensions.
%H Alois P. Heinz, <a href="/A208881/b208881.txt">Table of n, a(n) for n = 0..220</a>
%H J. Draisma, E. Horobet, G. Ottaviani, B. Sturmfels and R. K. Thomas, <a href="https://arxiv.org/abs/1309.0049">The Euclidean distance degree of an algebraic variety</a>, arXiv preprint arXiv: 1309.0049, 2013.
%F a(n) = (3*n)!/(3 * n!^3) for n>0, a(0) = 1.
%F a(n) = 2 * A060542(n) for n>0.
%F a(n) = A253283(2*n,n) for n>=0. - _Peter Luschny_, Mar 22 2015
%F n^2*a(n) -3*(3*n-1)*(3*n-2)*a(n-1)=0. - _R. J. Mathar_, Nov 01 2015
%e a(0) = 1: the empty word.
%e a(1) = 2 = |{abc, acb}|.
%e a(2) = 30 = |{aabbcc, aabcbc, aabccb, aacbbc, aacbcb, aaccbb, ababcc, abacbc, abaccb, abbacc, abbcac, abbcca, abcabc, abcacb, abcbac, abcbca, abccab, abccba, acabbc, acabcb, acacbb, acbabc, acbacb, acbbac, acbbca, acbcab, acbcba, accabb, accbab, accbba}|.
%p a:= n-> `if`(n=0, 1, (3*n)!/(3*n!^3)):
%p seq(a(n), n=0..20);
%Y Column k=3 of A208879.
%Y Cf. A060542, A253283.
%K nonn,walk
%O 0,2
%A _Alois P. Heinz_, Mar 02 2012