login
A129530
a(n) = (1/2)*n*(n-1)*3^(n-1).
5
0, 0, 3, 27, 162, 810, 3645, 15309, 61236, 236196, 885735, 3247695, 11691702, 41452398, 145083393, 502211745, 1721868840, 5854354056, 19758444939, 66248903619, 220829678730, 732224724210, 2416341589893, 7939408081077
OFFSET
0,3
COMMENTS
Number of inversions in all ternary words of length n on {0,1,2}. Example: a(2)=3 because each of the words 10,20,21 has one inversion and the words 00,01,02,11,12,22 have no inversions. a(n)=3*A027472(n+1). a(n)=Sum(k*A129529(n,k),k>=0).
FORMULA
G.f.: 3x^2/(1-3x)^3.
a(0)=0, a(1)=0, a(2)=3, a(n)=9*a(n-1)-27*a(n-2)+27*a(n-3). - Harvey P. Dale, Dec 18 2013
From Amiram Eldar, Jan 12 2021: (Start)
Sum_{n>=2} 1/a(n) = 2 * (1 - 2 * log(3/2)).
Sum_{n>=2} (-1)^n/a(n) = 2*(4*log(4/3) - 1). (End)
a(n) = 3*A027472(n+1). - R. J. Mathar, Jul 26 2022
MAPLE
seq(n*(n-1)*3^(n-1)/2, n=0..27);
MATHEMATICA
Table[(n(n-1)3^(n-1))/2, {n, 0, 30}] (* or *) LinearRecurrence[{9, -27, 27}, {0, 0, 3}, 30] (* Harvey P. Dale, Dec 18 2013 *)
PROG
(PARI) a(n)=n*(n-1)*3^(n-1)/2 \\ Charles R Greathouse IV, Oct 16 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Emeric Deutsch, Apr 22 2007
STATUS
approved