an=(n^2-n+1)/(2^n) 2an=(n^2-n+1)/2^(n-1)
an-1=[(n-1)^2-(n-1)+1]/2^(n-1) 2an-1=[(n-1)^2-(n-1)+1]/2^(n-2)
..
a2=(2^2-2+1)/2^2 2a2=(2^2-2+1)/2
a1=1/2 2a1=1
2Sn-[Sn-[(n^2-n+1)/2^n]]=(2n)/2^(n-1)+(2n-2)/2^(n-2)+2 +1
=2*[n/2^(n-2)+(n-1)/2^(n-3)+..+1]+1
Sn=2S'n+1-(n^2-n+1)/2^n
其中S'n=[n/2^(n-2)+(n-1)/2^(n-3)+..+1]
2S'n-S'n+n/2^(n-2)=[1/2^(n-3)+..+1]+2=4-1/2^(n-1)
S'n=4-1/2^(n-1)-n/2^(n-2)
Sn=8-1/2^(n-2)-n/2^(n-3)+1-(n^2-n+1)/2^n