an=n/2^n
Sn=a1+a2+a3+~~~+an=1/2^1+2/2^2+~~~+n/2^n
1/2×Sn=1/2^2+2/2^3+~~~+(n-1)2^n+n/2^(n+1)
Sn-1/2Sn=1/2Sn=1/2+1/2^2+1/2^3+~~~+1/2^n-n/2^(n+1)=(1/2-1/2^n×1/2)/(1-1/2)-n/2^(n+1)
=1-1/2^n-n/2^(n+1)=1-(2+n)/2×1/2^n
∴Sn=2-(2+n)×1/2^n