n为奇数时 Sn=2*1-1+2*3-1+.+2*n-1+2^2+2^4+.+2^(n-1)
={2*(1+n)*[(n+1)/2]}/2+[2^2(2^(n-1)/2-1)]/(2-1)
=n(n+1)/2+2^((n+3)/2)-4
n为偶数时 Sn=2*1-1+2*3-1+.+2*(n-1)-1+2^2+2^4+.+2^n
=2*(1+n-1)*(n/2)/2+[2^2*(2^(n/2)-1)]/(2-1)
=n(n-1)/2+2^((n+4)/2)-4
n为奇数时 Sn=2*1-1+2*3-1+.+2*n-1+2^2+2^4+.+2^(n-1)
={2*(1+n)*[(n+1)/2]}/2+[2^2(2^(n-1)/2-1)]/(2-1)
=n(n+1)/2+2^((n+3)/2)-4
n为偶数时 Sn=2*1-1+2*3-1+.+2*(n-1)-1+2^2+2^4+.+2^n
=2*(1+n-1)*(n/2)/2+[2^2*(2^(n/2)-1)]/(2-1)
=n(n-1)/2+2^((n+4)/2)-4