Sn=A1+A2+A3+……+An
Sn=(2*1-1)*3^1+(2*2-1)*3^2+(2*3-1)*3^3+……+(2n-1)*3^n……①
3Sn= (2*1-1)*3^2+(2*2-1)*3^3+(2*3-1)*3^4+……+(2n-1)*3^(n+1)……②
②-①得2Sn=- (2*1-1)*3^1+2*3^2+2*3^3+2*3^4+……+2*3^n+(2n-1)*3^(n+1)
=-3+2(3^2+3^3+3^4+……+3^n)+(2n-1)*3^(n+1)
=-3+2(3^2(1-3^(n-1))/(1-3))+(2n-1)*3^(n+1)
Sn=-3/2+9*(3^(n-1)-1)+(2n-1)*3^(n+1)/2